Repository Forums Support WooCommerce Extended Coupon Features PRO Get Free Gist Value to pass

Topic Resolution: Resolved
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #6007
    daniel.moore
    Participant

    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);
    #6042
    Soft79
    Keymaster

    Free items in the cart get a meta with key ‘_wjecf_free_product_coupon’. I’m not sure if this meta field is stored in the database though…

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.