Details
-
Bug
-
Resolution: Unresolved
-
Medium
-
None
-
4.6.x-dev, 4.6.2, 5.0.x-dev
-
Basic DDEV install with
- PHP 8.1
- nginx 1.24.0
- MariaDB 10.4.30
-
Ibexa Commerce
Description
When a product is deleted, its product code is freed but not its variant product code.
Step to reproduce on a clean install:
- I create an attribute groupe.
- I create an attribute "Selection" in previous attribute group and set two options.
- I create a product type, drag-n-drop the attribute group in the Attributes field, set the attribute "Used for product variants" to "on", leave the default for "Field definitions" and optional fields.
- I create a product of this type.
- I generate its variants with the "Generate variants" button for the two options.
- I delete the product.
- I recreate the same product (at least a product with the same product code).
- I generate the variants: Error “SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '<product_code>-1' for key 'ibexa_product_code_uidx'“.
Same things happen with manually creating a variant instead using the generator. If a code has been used for a variant, deleting the product won't make the code available for variant recreation.