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!
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!
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.
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!
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.
if you still have problem — please, submit your settings as new ticket to https://algolplus.freshdesk.com/
use tab Tools to get the settings.