0

I like to get current year in my order and invoice number.

Now i'm getting order id example: "XX-000001" i need to get like "XX-190001" this (19) is current year that need to be change in dynamic.

Please let me know how to change?

1

Magento 2 get the increment sequencing information from sales_sequence_profile table for order/invoice/shipment etc. All the sequencing params like prefix, suffix are fetched from this table. You need to update prefix column from this table to current year as string. eg: "2019-". All further orders will have this as prefix.

Option 1: Manually change the prefix at start of every year from this table.

Option 2 : Write a cron job that will get executed once in a year. This cron job will change the value of prefix column to current year for your order meta_id record in sales_sequence_profile.

To know more about sales_sequence_profile table please refer http://blog.chapagain.com.np/magento-2-change-increment-id-prefix-suffix-start-value-step-pad-length-of-order-invoice-creditmemo-shipment/.

Hope this finds you helpful..

0

Hi Just i add "date("y")" in module/sequnce.php file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.