Hi,
We are using another plugin to export each order as an XML file.
We have the following script, it works great to grab parts of the product, but I would like to grab a condition.
If order has a free gift then return the value of the free gift so the value of the free gift can be passed on to a new field.
This is where I’ve got to but it doesn’t work…
foreach ( $order->get_items('line_item') as $item_id=>$item ) {
$product = $order->get_product_from_item( $item );
if(!$product) // skip deleted products
continue;
$sbc_freebie = $product->wjecf_free_cart_item_price();
}
return wc_format_decimal($sbc_freebie, 2);