Fix parent product price cleared when variant price is changed#2974
Draft
Fix parent product price cleared when variant price is changed#2974
Conversation
Replace clone of ProductStoreValues with new instance creation via factory to prevent shared Doctrine identity (ID) from causing the parent's database record to be updated when persisting the variant's store values. Fixes the regression where changing a variant's price would reset the parent product's price and VAT to 0. Co-authored-by: dpfaffenbauer <5981845+dpfaffenbauer@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix clearing price and VAT on parent product when variant price changes
Fix parent product price cleared when variant price is changed
Feb 16, 2026
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Changing a variant's price overwrites the parent product's price/VAT to 0. Root cause:
cloneon a Doctrine-managedProductStoreValuesentity preserves theid, so persisting the "new" variant entity actually updates the parent's DB record.Replace
clonewith factory-created instances in both code paths:preSetData(admin form path): New blank entity viagetFactory()->createNew(). The Symfony form submission immediately populates all fields (store, price, taxRule, unitDefinitionPrices), so no property copying needed.save(programmatic path): New entity via factory with explicit copy of store, price, and taxRule from the inherited entity before persist.Regression of #1486, previously patched in #1491 for CoreShop 2.2.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.