When adding a new product to a store, the SKU should only be unique for that store, rather than globally across all stores.

Comments

joshtaylor’s picture

Status: Active » Needs review
joshtaylor’s picture

Status: Needs review » Needs work

Actually on second thought, this will require tests.

rszrama’s picture

It seems to me this may also need a validator to ensure you cannot change the store ID of the product to that of another store that already contains the same SKU.

bojanz’s picture

The UI assumption is that you will never be able to change the store_id, just like you can't change the bundle.

On the code level, we should check if core does anything to prevent bundle changes, and follow its lead.

  • joshtaylor committed 2d44e3e on 8.x-2.x
    Issue #2478631: SKUs should only be unique on a per-store basis
    
  • bojanz committed d851337 on 8.x-2.x
    Merge pull request #196 from joshuataylor/sku-unique-per-store-2
    
    Issue...
bojanz’s picture

Status: Needs work » Closed (won't fix)

Reverted in https://github.com/commerceguys/commerce/commit/4bfdcd6ef875aaf4656bdafb..., as a part of preparing for the new product architecture (which will allow a product to belong to multiple stores).

I've done some investigating, and other ecommerce systems (which allow multistore and products in multiple stores, for example Magento) keep the sku validation global. Sites can always use a sku prefix to get around this in certain cases.