I have been here for the last 5 hours trying to figure out something. I need to be able to fetch the cross sell id of a product in the woo commerce in the order confirmation email. Up to now I have
$items = $order->get_items();
foreach ( $items as $item ) {
$product_id = $item['product_id'];
}
And this retrive the id of the product. As there is always just going to be one cross sell product how can I get the id of that product in a variable?
This will be the last part of an affiliated program I am building for a guy but I now if fetches the purchased product id and I need the cross-sell one.
First you need cross sell product id for that product
so it can be like:
Now as we have all related cross cell product’s id, let’s get there information