Cost of Goods not showing in export as csv

Forums Cost of Goods for WooCommerce Cost of Goods not showing in export as csv

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #111821
    santosh
    Participant

    I changed the code to

    $product_cost = get_post_meta( $item_id, ‘_alg_wc_cog_cost’, true );

    It now works

    Thanks
    Santosh

    #112159
    Pablo
    Moderator
    Plugin Support

    Hi Santosh,

    Since you’re getting the cost from an order item, it’s probably more reliable to get it from the order item meta instead of the product meta. You could do it like this:

    foreach ( $order->get_items() as $item_id => $item ) {
    wc_get_order_item_meta( $item_id, '_alg_wc_cog_item_cost' );
    
    • This reply was modified 2 years, 1 month ago by Pablo.
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.