Magento2: Sales Order Increment Prefix not working

Created on 6 Jan 2016  路  5Comments  路  Source: magento/magento2

The increment_prefix in eav_entity_store table doesn't seem to be getting applied to order numbers. Here's the steps I'm taking to reproduce on a clean install:

Installed Magento via composer's metapackage. Made sure that I was logged in as the filesystem owner and ran the following setup via cli:

bin/magento setup:install --base-url=http://localhost/ --db-host=localhost --db-name=magento --db-user=magento --db-password=magento123 --admin-firstname=Magento --admin-lastname=User [email protected] --admin-user=admin --admin-password=admin123 --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1 --sales-order-increment-prefix=3 --cleanup-database

The installation script generates the following entry in eav_entity_store:
entity_store_id : 1, entity_type_id : 5, store_id : 1, increment_prefix : 3, increment_last_id : NULL

I set up cron to make sure indexers were running. I create a test product followed after by an order via the admin. I create the customer from the order entry screen. Upon saving the order, the sales order number was "000000001". It failed to pick up the prefix.

In a second attempt, I reindexed and flushed the cache. I created a second order and unfortunately it generates an order with "000000002".

I double checked the eav_entity_type table and order is listed with an entity_type_id of 5 which matches that in eav_entity_store. I also attempted to set the increment_last_id in eav_entity_store, reindex/flushed, and still nothing.

I've been working on clean installs for this issue since I have a site in production that I've been unable to update the increment_last_id for orders on no matter what I do. Has anyone been able to update the order numbers? I figured I'd try doing a simple prefix on a clean install to see if I could narrow down the problem.

Most helpful comment

@andimov This is still an issue. What additional response are you looking for? Please don't blindly close bugs.

All 5 comments

I ran into some similar expectations with the eav_entity_store. I tracked a few things down that did affect the increment_id. There is the use of the sales_sequence_meta table used by the Magento\SalesSequence module, and it appears to define for each store what table contains the sequence for each entity_type for a store. I then found the associated table sales_sequence_profile where there is a prefix and suffix column for each meta_id in the sales_sequence_meta table. I added a prefix value of "ORD" for the entity_type "order" on store_id 1 and it generated an increment_id like "ORD000000012".

I didn't find any immediate documentation or discussion on the matter when searching, but maybe knowing the use of the sequence module and tables will help point the direction for how this should be typically modified, and what the purpose of the eav_entity_store table is now.

We had bigger fish to fry so we ended up purchasing an extension to solve the issue for us. Looks like they went about the plugin method to intercept and override the increment function. The extension also syncs up invoice/shipment/and credit numbers to order numbers, so instead of re-inventing the wheel, we just moved forward with it.

@tigerx7 if still have the problem contact me and i will provide you my own module for the prefix order number/invoice

@tigerx7
According to contributor guide, tickets without response for two weeks should be closed.
Please feel free to reopen if it's needed.

@andimov This is still an issue. What additional response are you looking for? Please don't blindly close bugs.

Was this page helpful?
0 / 5 - 0 ratings