Export orders based on delivery date
Delivery plugins usually use order meta field with name “Delivery Date” or “delivery_date” (or similar field).
Note – Local Pickup Plus – code at bottom
If you want to export orders to deliver them tomorrow, you have to do these actions
1. Open section “Filter by order”, select “delivery” field in 1st dropdown, select operator =, type {tomorrow}, press Enter and press (+)
2. Open section “Misc Settings” and add following PHP code.
1 2 3 4 5 6 7 8 |
// replace {tomorrow} with actual values comparison operators add_filter('woe_settings_validate_defaults', function ($settings) { $settings = json_encode($settings); // to string $tomorrow = date("Y-m-d" , strtotime("+1 day", current_time( 'timestamp' ) )); // EDIT? $settings = str_replace( '{tomorrow}', $tomorrow, $settings); $settings = json_decode($settings, true); // to array return $settings; } ); |
3. You must ensure if date format for {tomorrow} match to your dates!
We use date mask (more about formats – https://www.php.net/manual/en/function.date.php )
Some common masks + output for 17th April 2020.
Y-m-d will output 2020-04-17
m/d/y will output 04/17/20
j F, Y will output 17 April, 2020
Default mask is “Y-m-d”, probably, you have to EDIT it.
Warning! Local Pickup Plus plugin uses different way to remember shipping date . So open section “Misc Settings” and add following PHP code.
1 2 3 4 5 6 7 8 9 |
add_filter('woe_settings_validate_defaults', function($settings){ $date = date("Y-m-d" , strtotime("+1 day", current_time( 'timestamp' ) )); // EDIT? $settings["item_metadata"]= array("shipping:_pickup_appointment_start LIKE " .$date ); return $settings; }); add_filter("woe_sql_get_order_ids", function($sql,$settings){ $sql = str_replace("meta_1.meta_value ", "FROM_UNIXTIME(meta_1.meta_value , '%Y-%m-%d')", $sql); return $sql; },10,2); |