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

Command icon 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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

TonyTheFerg created an issue. See original summary.

ericchew made their first commit to this issue’s fork.

mglaman’s picture

What 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

ericchew’s picture

Status: Active » Needs review

Thanks 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.

tonytheferg’s picture

Status: Needs review » Reviewed & tested by the community

  • ericchew committed db02f85 on 2.0.x
    Issue #3191998 by ericchew: Changing discount percentage requires...
ericchew’s picture

Status: Reviewed & tested by the community » Fixed

Merged!

ericchew’s picture

tonytheferg’s picture

Status: Fixed » Closed (fixed)