- Issue created by @ts.ag
- First commit to issue fork.
- 🇩🇪Germany Anybody Porta Westfalica
This is the related code:
public function getData(): array { // @todo leverage config for token replacement. $order_item = $this->getContextValue('item'); assert($order_item instanceof OrderItemInterface); $unit_price = $order_item->getUnitPrice(); assert($unit_price !== NULL); $adjusted_price = $order_item->getAdjustedUnitPrice(); assert($adjusted_price !== NULL); $item_data = [ 'item_name' => $order_item->label(), 'affiliation' => $order_item->getOrder()->getStore()->label(), 'discount' => $unit_price->subtract($adjusted_price)->getNumber(), 'price' => $this->formatPriceNumber($unit_price), 'quantity' => (int) $order_item->getQuantity(), ];
assert($unit_price !== NULL);
safes us in dev, but not in prod, I guess?We maybe this needs more defensive checking also for production?
This is major for Drupal Commerce projects. - Merge request !101Issue #3489811: AddToCartEvent WSOD for order items with no price → (Open) created by Anybody
- 🇩🇪Germany Anybody Porta Westfalica
Maybe something like this? (See MR)
🐛 Call to a member function getCurrencyCode() on null Active should also be applied (and merged before this one).