public function PriceResolverInterface::resolve in Commerce Core 8.2
Resolves a price for the given purchasable entity.
Use $context->getData('field_name', 'price') to get the name of the field for which the price is being resolved (e.g "list_price", "price").
Parameters
\Drupal\commerce\PurchasableEntityInterface $entity: The purchasable entity.
string $quantity: The quantity.
\Drupal\commerce\Context $context: The context.
Return value
\Drupal\commerce_price\Price|null A price value object, if resolved. Otherwise NULL, indicating that the next resolver in the chain should be called.
3 methods override PriceResolverInterface::resolve()
- ChainPriceResolver::resolve in modules/
price/ src/ Resolver/ ChainPriceResolver.php - Resolves a price for the given purchasable entity.
- DefaultPriceResolver::resolve in modules/
price/ src/ Resolver/ DefaultPriceResolver.php - Resolves a price for the given purchasable entity.
- TestPriceResolver::resolve in modules/
price/ tests/ modules/ commerce_price_test/ src/ TestPriceResolver.php - Resolves a price for the given purchasable entity.
File
- modules/
price/ src/ Resolver/ PriceResolverInterface.php, line 30
Class
- PriceResolverInterface
- Defines the interface for price resolvers.
Namespace
Drupal\commerce_price\ResolverCode
public function resolve(PurchasableEntityInterface $entity, $quantity, Context $context);