umbraco / Umbraco.Commerce.Issues

18 stars 2 forks source link

Same sku can be saved #509

Open JamiePattison opened 3 months ago

JamiePattison commented 3 months ago

I cant tell if there is a way to achieve this from the Commerce package or whether its a bug. If i add a product ID (or a SKU) into Umbraco with the field set with the alias sku, then i can add another product with the same SKU which allows to be saved.

I dont believe the same SKU should be allowed as it would be difficult to write/compare a report of what product was purchased if the SKU is the same?

mattbrailsford commented 3 months ago

Yea, I don't think we enforce this as the main unique element we use is the productReference. If you do want to enforce this you could add a validation handler for the ValidateOrderProductAdd validation event and fail the action if a product with that SKU but a different productRefernce already exists.