+++ b/src/Plugin/Field/FieldFormatter/PriceRuleFormatter.php
@@ -0,0 +1,55 @@...

Contribution Date
Technology
Contribution Project
Contribution Details
+++ b/src/Plugin/Field/FieldFormatter/PriceRuleFormatter.php @@ -0,0 +1,55 @@ + '#cache' => [ + 'tags' => $purchasable_entity->getCacheTags(), + 'contexts' => Cache::mergeContexts($purchasable_entity->getCacheContexts(), [ + 'languages:' . LanguageInterface::TYPE_INTERFACE, + 'country', + ]), + ],

Since cache tag only dependes on $purchasable_entity, therefore it can be created as an array variable outside the loop. We can then just use the variable in #cache

Contribution Author
Files count
0
Patches count
0