Skip to content

Cart line item is missing regulation price #14647

@remyvv

Description

Shopware Version

6.7.6.2

Affected area / extension

Platform(Default)

Actual behaviour

When adding a product to the cart, the regulation price is left empty in the price-definition and thus is also missing from the calculated price of a cart line-item.

Relevant code section (ProductCartProcessor::buildPriceDefinition):

private function buildPriceDefinition(CalculatedPrice $price, int $quantity): QuantityPriceDefinition
{
$definition = new QuantityPriceDefinition($price->getUnitPrice(), $price->getTaxRules(), $quantity);
if ($price->getListPrice() !== null) {
$definition->setListPrice($price->getListPrice()->getPrice());
}
if ($price->getReferencePrice() !== null) {
$definition->setReferencePriceDefinition(
new ReferencePriceDefinition(
$price->getReferencePrice()->getPurchaseUnit(),
$price->getReferencePrice()->getReferenceUnit(),
$price->getReferencePrice()->getUnitName()
)
);
}
return $definition;
}

Expected behaviour

The regulation-price is also added to the price object of a cart line-item, in order to show regulation-price difference in the shopping-cart.

Here's a patch, that fixes this:
productcartprocessor_add_regulation_prices.patch

How to reproduce

  • Add a product with a configured regulation-price to the cart.
  • Observe the regulation-price not being present in the cart.

Metadata

Metadata

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions