Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Changing the discount percentage on a variation or group requires clearing the caches for price resolver to reflect the changes.
Proposed resolution
Fix it
Issue fork commerce_vado-3191998
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
mglamanWhat needs to be done:
Pseudo code ahoy:
* hook_commerce_product_view to append cache data
* get all referenced groups ->get($field_name)->referencedEntities()
* foreach $refererenced_entity => $reference_entity->getCacheabilityMetadata->applyTo($build)
So the cache tags for each group need to end up on the product, so when a group is modified it will invalidate the product render array
Comment #5
ericchew CreditAttribution: ericchew commentedThanks for the suggestion Matt! It lead to me to figure out the issue and was able to fix it properly within the entity class without a hook.
Comment #6
tonytheferg CreditAttribution: tonytheferg commentedComment #8
ericchew CreditAttribution: ericchew commentedMerged!
Comment #9
ericchew CreditAttribution: ericchew commentedComment #10
tonytheferg CreditAttribution: tonytheferg commented