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?
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
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..