Hello
1. you should select field in dropdwon, use operator “=”, type {today} and press button (+).
so you will see condition “fieldname={today}”.
2. add following code to section “Misc Settings”
// replace {today} with actual values in settings
add_filter('woe_settings_validate_defaults', function ($settings) {
$settings = json_encode($settings); // to string
$today = date("Y-m-d" , current_time( 'timestamp' ) );// TWEAK format!
$settings = str_replace( '{today}', $today, $settings);
$settings = json_decode($settings, true); // to array
return $settings;
} );
thanks, Alex
Thread Starter
mrjotd
(@mrjotd)
Hello,
I have added the code to the ‘Misc Settings’ and tweaked the date to return as m/d/y as this is how I need it to be formatted, I also typed {today} in to the dropdown, this is not returning any results. When I test using a rendered value of the custom field the orders I expect to see appear however.
Could you mark “enable debug output”( section “Misc Settings”) and press Preview ?
Will you see some SQLs ? Could you paste them here ?
-
This reply was modified 7 years, 8 months ago by
algol.plus.
Thread Starter
mrjotd
(@mrjotd)
Hello,
This is the SQL I am seeing: SELECT ID AS order_id FROM wp_posts AS orders LEFT JOIN wp_postmeta AS ordermeta_cf_1 ON ordermeta_cf_1.post_id = orders.ID AND ordermeta_cf_1.meta_key=’byconsolewooodt_delivery_date’ WHERE orders.post_type in ( ‘shop_order’) AND 1 AND orders.post_status NOT in (‘auto-draft’,’trash’) AND ( ordermeta_cf_1.meta_value IN (’09/14/18′) ) AND orders.ID IN ( SELECT order_id FROM wp_woocommerce_order_items WHERE order_item_type=’shipping’ AND order_item_name IN (‘Flat Rate’) )
it looks good.
if you add field “byconsolewooodt_delivery_date” to export , do you see “09/14/18” ? or 9/14/18?
thanks, Alex
-
This reply was modified 7 years, 8 months ago by
algol.plus.
Thread Starter
mrjotd
(@mrjotd)
The output is showing as 09/14/2018 , I am gathering that it may just be an issue with how I have stated the date output?
Thanks, Josh
Thread Starter
mrjotd
(@mrjotd)
Just changed my formatting and all is well!
Thank you for your help Alex!