Skip to content

Fix variant selection on product detail page - #23

Open
shochdoerfer wants to merge 1 commit into
Sylius:1.0from
bitExpert-forks:fix/variant_selection
Open

Fix variant selection on product detail page#23
shochdoerfer wants to merge 1 commit into
Sylius:1.0from
bitExpert-forks:fix/variant_selection

Conversation

@shochdoerfer

Copy link
Copy Markdown
Contributor

Fixes #22

The AddToCartFormComponent class re-uses the ComponentWithFormTrait even though it extends the Sylius base component which already uses it. This creates two separate copies of the private properties and private methods which seems to cause an issue. Removing the trait fixes the issue, the variant selector is now properly refreshing the summary component again.

@crydotsnake

Copy link
Copy Markdown
Member

CC @GSadee / @TheMilek

Comment thread src/Twig/Component/Product/AddToCartFormComponent.php Outdated
@shochdoerfer
shochdoerfer force-pushed the fix/variant_selection branch from a7603bf to 2be4512 Compare August 10, 2026 06:28
@jkindly

jkindly commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

The trait is already provided by the parent BaseAddToCartFormComponent, so re-declaring it created a duplicate set of the trait's private properties ($form, $formView, …) in the child scope, desynchronizing the form state and preventing the price from refreshing on variant change. I verified that the child inherits the trait (and its abstract instantiateForm() contract) entirely through the parent - no method here relies on a local copy of the trait - so this is a safe, behavior-preserving change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

After installing the plugin, the product detail page is broken

3 participants