Skip to content
Snippets Groups Projects
Commit 0f78ee4e authored by Bojan Živanović's avatar Bojan Živanović
Browse files

Issue #3005098 by rlmumford, bojanz: Backwards compatibility break in...

Issue #3005098 by rlmumford, bojanz: Backwards compatibility break in DefaultPriceResolver (due to list_price support)
parent 6907df4c
No related branches found
No related tags found
No related merge requests found
......@@ -15,7 +15,12 @@ class DefaultPriceResolver implements PriceResolverInterface {
*/
public function resolve(PurchasableEntityInterface $entity, $quantity, Context $context) {
$field_name = $context->getData('field_name', 'price');
if ($entity->hasField($field_name) && !$entity->get($field_name)->isEmpty()) {
if ($field_name == 'price') {
// Use the price getter to allow custom purchasable entity types to have
// computed prices that are not backed by a field called "price".
return $entity->getPrice();
}
elseif ($entity->hasField($field_name) && !$entity->get($field_name)->isEmpty()) {
return $entity->get($field_name)->first()->toPrice();
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment