[Skip to main content](#vessel-content)

#   Reset Order number

##

- **[Joomill](/forum/user/33738-joomill "View Joomill's Profile")**
- [![Joomill's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar33738.jpg)](/forum/user/33738-joomill "View Joomill's Profile") Topic Author
- [ Offline](/forum/user/33738-joomill)

Less More

- Posts: 224
- Thank you received: 10
-
-
- [](http://www.joomill.nl)
-

3 years 10 months ago [\#348580](#348580) by [Joomill](/forum/user/33738-joomill "View Joomill's Profile")  *[Reset Order number](/forum/35-orders-management/905755-reset-order-number#348580 "Hi,  I can reset the invoice number every year, but i would like to reset the order number also. (with removing old orders) and keep the order id and invoice id the same.  Is there a way to do this?")* was created by *[Joomill](/forum/user/33738-joomill "View Joomill's Profile")*

Hi,

I can reset the invoice number every year, but i would like to reset the order number also. (with removing old orders) and
keep the order id and invoice id the same.

Is there a way to do this?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50LzkwNTc1NS1yZXNldC1vcmRlci1udW1iZXI/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86583
- Thank you received: 14324
-
-

3 years 10 months ago [\#348585](#348585) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Reset Order number](/forum/35-orders-management/905755-reset-order-number#348585 "Hi,  I can reset the invoice number every year, but i would like to reset the order number also. (with removing old orders) and keep the order id and invoice id the same.  Is there a way to do this?")*

Hi,

You need to use {order_id} instead of {id} in the "invoice number format" so that it will use the order_id and not the order_invoice_id for the invoice number, like for the order number.
To reset the order_id (and thus the order_number generated from it), you need to remove all the orders from the hikashop_order table :
[ www.quora.com/How-do-I-truncate-a-MySQL-...sing-Xamp-phpMyAdmin](https://www.quora.com/How-do-I-truncate-a-MySQL-table-using-Xamp-phpMyAdmin)
It should both remove all the orders and reset the auto_increment value of the table (which can be changed manually if necessary after removing all the entries: [ dba.stackexchange.com/questions/43812/ho...t-to-1-in-phpmyadmin](https://dba.stackexchange.com/questions/43812/how-can-i-reset-a-mysql-table-auto-increment-to-1-in-phpmyadmin) )

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50LzkwNTc1NS1yZXNldC1vcmRlci1udW1iZXI/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Joomill](/forum/user/33738-joomill "View Joomill's Profile")**
- [![Joomill's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar33738.jpg)](/forum/user/33738-joomill "View Joomill's Profile") Topic Author
- [ Offline](/forum/user/33738-joomill)

Less More

- Posts: 224
- Thank you received: 10
-
-
- [](http://www.joomill.nl)
-

3 years 10 months ago [\#348589](#348589) by [Joomill](/forum/user/33738-joomill "View Joomill's Profile")  Replied by *[Joomill](/forum/user/33738-joomill "View Joomill's Profile")* on topic *[Reset Order number](/forum/35-orders-management/905755-reset-order-number#348589 "Hi,  I can reset the invoice number every year, but i would like to reset the order number also. (with removing old orders) and keep the order id and invoice id the same.  Is there a way to do this?")*

Hi,

Thanks, but i can't remove old orders. I just need to start at 1 in the new year.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50LzkwNTc1NS1yZXNldC1vcmRlci1udW1iZXI/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86583
- Thank you received: 14324
-
-

3 years 10 months ago [\#348590](#348590) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Reset Order number](/forum/35-orders-management/905755-reset-order-number#348590 "Hi,  I can reset the invoice number every year, but i would like to reset the order number also. (with removing old orders) and keep the order id and invoice id the same.  Is there a way to do this?")*

Hi,

Well, it's you who said you wanted to remove the old orders:

> (with removing old orders)

So I was answering to that.

The order number is generated from the order_id. The order_id is automatically incremented for each new order created. For the order number to start at 1 in the new year, it means that the order_id also need to start at 1 and thus the order table has to be emptied.

If you want to reset the order number at 1 every year without deleting all the orders, it requires the development of a plugin.
You would have to implement the event onBeforeOrderNumberGenerate(&amp;$data, &amp;$result) in your custom plugin.
In it, you would first load the maximum order_number of all the orders already created since the 1st day of the current year with a MySQL query, and then increment it by 1 and set $result with that new number.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50LzkwNTc1NS1yZXNldC1vcmRlci1udW1iZXI/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.042 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
