• Resolved stevendehaard

    (@stevendehaard)


    Hello,

    I’ve an issue with the order date formatting on the packing slip. I’m using the free version of the plugin.

    I’ve tried to adjust the format by added the filter to my functions.php file as described in the plugin’s help section, but it doesn’t work as expected:

    add_filter(‘wf_pklist_alter_order_date’,’wt_pklist_change_order_date_format’,10,3);
    function wt_pklist_change_order_date_format($order_date, $template_type, $order){
    /* new date format */
    return date(“d-m-Y”,strtotime($order_date));
    }

    I would expect it would give 04-06-2024 as output, but it switches the day and month. Of course, I could adjust the filter to use ‘m-d-Y’ as pattern, but this is not a very nice solution. Could please investigate this issue and advise or fix this in a following release of the plugin?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support WebToffee Support

    (@webtoffeesupport)

    Hi stevendehaard,

    Thanks for reaching out.

    There was a syntax error in the code used. You may use the following code snippet to change the date format to “d-m-Y”.

    add_filter('wf_pklist_alter_order_date', 'wt_pklist_change_order_date_format', 10, 3);
    function wt_pklist_change_order_date_format($order_date, $template_type, $order)
    {
    /* new date format */
    return date( "d-m-Y", strtotime( $order_date ) );
    }
    Thread Starter stevendehaard

    (@stevendehaard)

    Hello, I’ve tried this snippet but it still doesn’t work… it still results in 6-8-2024 as order date instead of 8-6-2024 on the packing slip. Any other thoughts?

    Plugin Support WebToffee Support

    (@webtoffeesupport)

    Hi stevendehaard,

    Thanks for sharing the update. Kindly try using the below given code snippet and check.

    add_filter('wf_pklist_alter_order_date', 'wt_pklist_change_order_date_format', 10, 3);

    function wt_pklist_change_order_date_format($order_date, $template_type, $order) {
    if ( "packinglist" === $template_type && !empty( $order ) ) {
    $order_id = $order->get_id();
    $order_date = get_the_date( 'd-m-y', $order_id );
    }

    return $order_date;
    }
    Thread Starter stevendehaard

    (@stevendehaard)

    Hello,

    This does work. Thanks a lot for the snippet!

    Plugin Support WebToffee Support

    (@webtoffeesupport)

    Hi stevendehaard,

    We are glad to have helped you. If you like the plugin and support, please?leave us a review here. It would really help us spread the word.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Order date format on packing slip is not correct’ is closed to new replies.