After creating a variant element and saving its product, two variants can become marked as the "default."
I suspect this is due to the way “primary ownership” works for nested elements—the new variant's primary owner is the product draft, not the canonical product element. When adding multiple new variants to the same product, only one of the new elements is marked as the default.
What happened?
Description
After creating a variant element and saving its product, two variants can become marked as the "default."
I suspect this is due to the way “primary ownership” works for nested elements—the new variant's primary owner is the product draft, not the canonical product element. When adding multiple new variants to the same product, only one of the new elements is marked as the default.
https://github.com/craftcms/commerce/assets/1895522/0d5fb5c2-9417-4096-b924-0d412b392e5c
Steps to reproduce
Expected behavior
The default variant is reconciled based on the canonical product element, not derivatives.
Craft CMS version
5.2.4.1
Craft Commerce version
5.0.11.1
PHP version
8.2.20
Operating system and version
Docker/DDEV
Database type and version
MySQL 8.0.36
Image driver and version
No response
Installed plugins and versions