/**
* `change()` allows a price overwrite of the current price scope. The provided price will be recalculated
* over the quantity price calculator to consider quantity, tax rule and cash rounding configurations.
*
* @example pricing-cases/product-pricing.twig 40 5 Overwrite prices with a static defined collection
*
* @param PriceCollection $price The provided price can be a fetched price from the database or generated over the `PriceFactory` statically
*/
public function change(PriceCollection
$price): void
{ $value =
$this->
getPriceForTaxState($price,
$this->context
);
$definition =
new QuantityPriceDefinition( $value,
$this->price->
getTaxRules(),
$this->
getQuantity() );
$this->
overwrite($definition);
} /**
* `plus()` allows a price addition of the current price scope. The provided price will be recalculated via the quantity price calculator.
* The provided price is interpreted as a unit price and will be added to the current unit price. The total price
* is calculated afterwards considering quantity, tax rule and cash rounding configurations.
*
* @example pricing-cases/product-pricing.twig 14 5 Plus a static defined price to the existing calculated price
*
* @param PriceCollection $price The provided price can be a fetched price from the database or generated over the `PriceFactory` statically
*/