<span class="resolved" aria-label="Resolved" title="Topic is resolved."></span>SKU with QTY ( error)

[ad_1]

Replies: 2

Hello !

I am trying to use following code , to create a field , containing both Qty and Sku.

I followed this thread, but getting on exporting file a critical error.
Weirdly but on preview it seems working.

https://projectdmc.org/support/topic/i-need-column-that-need-sku-multiply-quantity/

add_filter('woe_get_order_value_all_products',function ($value, $order,$fieldname) {
    $lines = array();
    foreach($order->get_items() as $item) {
        $product = $order->get_product_from_item( $item );
        $lines[] = $product->get_sku(). "-" .$item["qty"];
    }
    return join("; ", $lines);
},10,3);

Fatal error: Uncaught Error: Call to a member function get_sku() on bool in //plugins/woo-order-export-lite/classes/core/class-wc-order-export-engine.php(369) : eval()'d code:5 Stack trace: #0 //wp-includes/class-wp-hook.php(326): WC_Order_Export_Engine::{closure}('', Object(WC_Order), 'sku1') #1 //wp-includes/plugin.php(205): WP_Hook->apply_filters('', Array) #2 //plugins/woo-order-export-lite/classes/core/trait-woe-core-extractor.php(999): apply_filters('woe_get_order_v...', '', Object(WC_Order), 'sku1', Object(WC_Order)) #3 //plugins/woo-order-export-lite/classes/core/class-wc-order-export-engine.php(520): WC_Order_Export_Data_Extractor::fetch_order_data('1263', Array, Array, Array, Array) #4 //plugins/woo-orde in //plugins/woo-order-export-lite/classes/core/class-wc-order-export-engine.php(369) : eval()'d code on line 5

There has been a critical error on this website.
  • This topic was modified 2 hours, 7 minutes ago by ernest_d.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer