• Resolved prodograw

    (@prodograw)


    Hi i use order delivery from woocommerce and need to filter by delivery date i have populated custom fields like below

    my issue is i need to programically add the value of the date not just dropdown can i do this?
    e.g

    add_filter('woe_get_order_value_order_custom_fields',function ($value, $order,$fieldname) {
      
      $value = "_delivery_date = ".date('Y-m-d', strtotime("1 day", date('Y-m-d')));
    
      return $value;
    },10,3); 
    • This topic was modified 5 years, 2 months ago by prodograw.
    • This topic was modified 5 years, 2 months ago by prodograw.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author algol.plus

    (@algolplus)

    Hello

    1. please, don’t select exact date!
    type {tomorrow}, press Enter and click (+) .
    so you will add condition “_delivery_date={tomorrow}”

    2. open section “Misc Settings” and out this PHP code.
    thanks, Alex

    // replace {tomorrow} with actual values comparison operators
    // tweak formats for your needs!
    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' ) ));
    	$settings = str_replace( '{tomorrow}', $tomorrow, $settings);
    	$settings = json_decode($settings, true); // to array
    	return $settings;
    } );
    Thread Starter prodograw

    (@prodograw)

    works a treat thanks

    Plugin Author algol.plus

    (@algolplus)

    you’re welcome

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom Filter’ is closed to new replies.