• Resolved alortiz3

    (@alortiz3)


    alortiz3

    Hello,

    We are currently running Advanced Order Export pro for WooCommerce. I would like to know if there is a way where I can export orders that match a specific criteria. Here is my current condition:
    We have a custom field called ‘Credit Limit’. I would like to export all orders where the “total amount” of the order exceeds ‘Credit Limit’. Is this possible with this plugin, and if so, how can I get it accomplished?

    Cheers!

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

    (@algolplus)

    hello

    please, use hook woe_order_export_started
    visit https://docs.algolplus.com/algol_order_export/filters-orders/ to check examples

    you should add code to section “Misc Settings”

    thanks, Alex

    Thread Starter alortiz3

    (@alortiz3)

    alortiz3

    Thank you very much that worked very well!

    Plugin Author algol.plus

    (@algolplus)

    You’re very welcome ??

    Thread Starter alortiz3

    (@alortiz3)

    alortiz3

    I thought this was working but come to find out, I get the notification for every order regardless of condition. Here is my code:

    //  export only orders with total > Credit Limit
    add_filter( 'woe_order_export_started',  function ( $order_id ) { 
      $order = new WC_Order($order_id);
      return   ($order->get_total()  > $credit_limit) ? $order_id: false;
    });

    Here is an example of the output:
    Order Number Order Status Order Date First Name (Billing) Last Name (Billing) Company (Billing) Email (Billing) Phone (Billing) Order Total Credit Limit
    4333 Processing 2022-01-06 08:26 Amber Bainbridge Trans Equipment Co Inc [email protected] (717) 859-2095 239.40 3000
    Attachments area

    Your help is always greatly appreciated!

    Plugin Author algol.plus

    (@algolplus)

    what is $credit_limit ?

    if it’s order field , use
    $order->get_meta("credit_limit")

    Thread Starter alortiz3

    (@alortiz3)

    alortiz3

    Thank you for your prompt response. $credit_limit is a custom field (Credit Limit). I just need to make sure that I get notifications when the order amount that is greater than the Credit Limit.

    Plugin Author algol.plus

    (@algolplus)

    You confused me, what plugin do you use to set Credit Limit?

    Please, contact to plugin’s author . I think they know how to get this value using PHP.

    Thread Starter alortiz3

    (@alortiz3)

    alortiz3

    Very sorry, I used the plugin custom fields to create the Credit Limit. I can get the value in the results by using ‘User_credit_limit’. But I don’t know how to use it when comparing the value. I’m using this value: return ($order->get_total() > $credit_limit) ? $order_id: false;

    Should I be using return ($order->get_total() > User_credit_limit) ? $order_id: false; instead?

    Thank you!

    Plugin Author algol.plus

    (@algolplus)

    please, try this version

    //  export only orders with total > Credit Limit
    add_filter( 'woe_order_export_started',  function ( $order_id ) { 
      $order = new WC_Order($order_id);
      $credit_limit = get_user_meta($order->get_user_id(), "credit_limit", true);
      return   ($order->get_total()  > $credit_limit) ? $order_id: false;
    });
    Thread Starter alortiz3

    (@alortiz3)

    alortiz3

    Thank very much! I will try it and let you know if I run into any issues.

    Plugin Author algol.plus

    (@algolplus)

    if you still have problem — please, submit your settings as new ticket to https://algolplus.freshdesk.com/

    use tab Tools to get the settings.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Conditional Field Export’ is closed to new replies.