• Hi there,

    Thanks for your very prompt support previously.

    For context, I deal with refrigerated and non-refrigerated products, and these are shipped separately. I intend to export 2 separate order lists – one for orders that contain refrigerated products, and one for orders which do not contain any refrigerated products.

    Hence, I am trying to implement a filter that exports orders where product_shipping_class for all items within the order do not contain a particular value (here the value is {keepcold}). The intention for this is to export a list of orders that only contain non-refrigerated products.

    At present i can only use Product Taxonomies to filter product_shipping_class, but this is at the product level, and does not operate at the order level. Is there a way to implement this on an Order level?

    Thank you for your help.

    Best,

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author algol.plus

    (@algolplus)

    Hi

    Could you open “Filter By Order” and unmark “Export all products from the order” ?
    thanks, Alex

    Thread Starter 3liastiong

    (@3liastiong)

    Hi there, I did as suggested.

    However, when someone in a single order orders BOTH a refrigerated AND a non-refrigerated item, the items in the order with the non-refrigerated shipping class still show up. However, my intention in such a scenario is for the entire order to be shipped as refrigerated.

    Which is why my query was how to export based on shipping class at the order level. Would that be possible?

    Thanks!

    Plugin Author algol.plus

    (@algolplus)

    hi

    It seems you have to check order items before exporting the order.
    It’s possible only using some PHP code.
    Tweak this code and add to “Misc Settings”.
    Thanks, Alex

    add_filter("woe_order_export_started", function($order_id){
      $no_keepcold = true;
      $order = new WC_Order($order_id);
      foreach ( $order->get_items('line_item') as $item_id=>$item ) {
         $product   = $order->get_product_from_item( $item );
         if( $product AND $product->get_shipping_class()== "{keepcold}")
            $no_keepcold = false;
      }
      return $no_keepcold? $order_id : false;
    });
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Filter based on items within an Order’ is closed to new replies.