Hi @dumbo16556,
Currently, the plugin does not support shortcode based inputs. We have added it to backlogs for future enhancements.
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 weeks??
Thank you very much for your fast supply
Hi @dumbo16556,
We have developed a custom snippet for you. Copy below code to your theme’s functions.php. Make sure to update the plugin 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 like the plugin, please leave us a review.
Thank 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 🙂
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_get_order($order_id);
if (is_object($order)) {
return date('Y_m_d', strtotime($order->get_date_created())) . "_";
} else {
return $order_number;
}
}
NEARLY THERE.. (sorry) you are going into the right direction 🙂
The year works now but instead of adding the sequential number it ads the buyer name.. strange
Hi @dumbo16556,
Can you please share a screenshot so that we can understand the issue better.
OK 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_get_order($order_id);
if (is_object($order)) {
return “Yourprefix_” .date(‘Y’, strtotime($order->get_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
somehow I cant add screenshots here.. sorry
imported orders are now: #prefix_2020_01_0001
new order: #0002
-
This reply was modified 4 years, 6 months ago by Dumbo16556.
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');
}
G R E A T you are my H E R O!!!
So once you update I simply take this snippet out, right?
Hi @dumbo16556,
We will let you know when we include this feature in the plugin. Till then, please keep the code snippet active.
Please leave us a review here, if you like the plugin and support.