• Resolved miikewordpress

    (@miikewordpress)


    Hi

    When I try to use filter by billing to export only 4 states and 9 postcodes(outside of those 4 states), the plugin returns error saying “Nothing to export”.
    I think the plugin first look for 4 states THEN look for postcodes inside those 4 states because states have higher hierarchy than postcodes.
    I’m not sure if this was intended by the plugin design.
    How should I go about exporting only 4 states and some postcodes outside of those states?

    Please see below image for better understanding.
    https://i.imgur.com/KTADZkH.png

    Thank you.

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

    (@algolplus)

    hi

    yes, these filters work as “AND”.
    So you should remove the filters, open section “Misc Settings” and paste following PHP code.
    please, edit list of postcodes.
    thanks, Alex

    add_filter('woe_order_export_started', function($order_id) {
      $order = new WC_Order($order_id);
      $states = array("TH-10","TH-11","TH-12","TH-13");
      $postcodes = array("23170","81150","82160");
       
      if( in_array($order->get_shipping_postcode(), $postcodes) OR in_array($order->get_shipping_state(), $states))
         return $order_id;
      else
        return false;
    });
    Thread Starter miikewordpress

    (@miikewordpress)

    Thank you it worked perfectly!

    Plugin Author algol.plus

    (@algolplus)

    you’re welcome

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Issues with Filtering by States and Postcodes’ is closed to new replies.