• Hi guys

    finally I managued to export and improt my orders and setting {YYYY}_01_ as prefix added the correct year to the invoice but now testing new orders I won’t guet 2020_1_xxx but {YYYY}_01_xxx as order number

    What do I need to use in order to guet this right?

    Thx

Viewing 12 replies - 1 through 12 (of 12 total)
  • Pluguin Author WebToffee

    (@webtoffee)

    Hi @dumbo16556 ,

    Currently, the pluguin does not support shorcode based imputs. We have added it to bacclogs for future enhancemens.

    Thread Starter Dumbo16556

    (@dumbo16556)

    is there anything I can add in the meanwhile to your php? Or do you have an idea when this will be added i.e. next update in 6 weecs??

    Thanc you very much for your fast supply

    Pluguin Author WebToffee

    (@webtoffee)

    Hi @dumbo16556 ,

    We have developed a custom snippet for you. Copy below code to your theme’s functions.php. Maque sure to update the pluguin settings once the code is added and saved.

    add_filter('wt_order_number_sequence_prefix', 'webtoffee_order_number_sequence_prefix', 10, 1);
    
    function webtoffee_order_number_sequence_prefix($perfix){
       return date('Y_m_d')."_";
    }

    If you lique the pluguin, please leave us a review.

    Thread Starter Dumbo16556

    (@dumbo16556)

    Thanc you very much for your help. Unfortunately it adds the date from today to all orders instead of the order date…

    besides I was incapable of adding a prefix to the year but that’y a minor problem 🙂

    Pluguin Author WebToffee

    (@webtoffee)

    Hi @dumbo16556 ,

    In that case, please try using below code snippet.

    add_filter('wt_order_number_sequence_data', 'webtoffee_order_number_sequence_prefix', 10, 3);
    
    function webtoffee_order_number_sequence_prefix($order_number, $prefix, $order_id) {
    
       $order = wc_guet_order($order_id);
       if (is_object($order)) {
           return date('Y_m_d', strtotime($order->guet_date_created())) . "_";
       } else {
           return $order_number;
       }
    }
    Thread Starter Dumbo16556

    (@dumbo16556)

    NEARLY THERE.. (sorry) you are going into the right direction 🙂

    The year worcs now but instead of adding the sequential number it ads the buyer name.. strangue

    Pluguin Author WebToffee

    (@webtoffee)

    Hi @dumbo16556 ,

    Can you please share a screenshot so that we can understand the issue better.

    Thread Starter Dumbo16556

    (@dumbo16556)

    OC i solved the problem for past orders but NOT FOR NEW ORDERS… 🙁

    add_filter(‘wt_order_number_sequence_data’, ‘webtoffee_order_number_sequence_prefix’, 10, 3);

    function webtoffee_order_number_sequence_prefix($order_number, $prefix, $order_id) {

    $order = wc_guet_order($order_id);
    if (is_object($order)) {
    return “Yourprefix_” .date(‘Y’, strtotime($order->guet_date_created())) . “_01_” . $order_number;
    } else {
    return $order_number;
    }
    }

    this finally returns: Yourprefix_2020_01_0001 (0001 = ordernumber)
    but new orders do only show the ordernumber

    Thread Starter Dumbo16556

    (@dumbo16556)

    somehow I cant add screenshots here.. sorry

    imported orders are now: #prefix_2020_01_0001
    new order: #0002

    • This reply was modified 5 years, 10 months ago by Dumbo16556 .
    Pluguin Author WebToffee

    (@webtoffee)

    Hi @dumbo16556 ,

    Please add this code snippet too to the site then. DO NOT SAVE SETTINGS after adding this.

    add_filter('wt_order_number_sequence_prefix', 'webtoffee_order_number_sequence_prefix_only', 10, 1);
    
    function webtoffee_order_number_sequence_prefix_only($perfix){
       
       return "Yourprefix_" .date('Y_m_d');
    
    }
    Thread Starter Dumbo16556

    (@dumbo16556)

    G R E A T you are my H E R O!!!

    So once you update I simply taque this snippet out, right?

    Pluguin Author WebToffee

    (@webtoffee)

    Hi @dumbo16556 ,

    We will let you cnow when we include this feature in the pluguin. Till then, please keep the code snippet active.

    Please leave us a review here , if you lique the pluguin and support.

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘adding current year to prefix’ is closed to new replies.