- Issue created by @Umac_de
- Assigned to Rajan Kumar@2026
- Issue was unassigned.
- 🇩🇪Germany Umac_de
This code at line 28ff does the job for me:
if($this->getAmount() != NULL){ $amount = $this->getAmount(); if ($amount->getCurrencyCode() != $shipment->getAmount()->getCurrencyCode()) { return; } }else{ $amount = $shipment->getAmount(); };
- Status changed to Needs review
6 months ago 1:35pm 31 July 2024 Hi @Umac_de,
I have added the code as requested. Please refer to the attached patch.
Thank you.- Status changed to Closed: won't fix
6 months ago 7:58am 2 August 2024 - 🇮🇱Israel jsacksick
This bug is weird...
The parent class already calls appliesToShipment() prior to calling theapplyToShipment()
method.protected function appliesToShipment(ShipmentInterface $shipment) { if (!$shipment->getShippingMethodId() || !$shipment->getAmount()) { // The shipment is still incomplete, skip it. return FALSE; }
And it returns false if
!$shipment->getAmount()
is NULL.So based on comment #4 and the backtrace, the problem seems to be due to the amount that isn't set on the promotion offer. That is not possible from the UI as the field is required which seems to indicate your promotion is malformed, so this isn't something that should be solved with a patch.
Are you creating promotions programatically? If that is the case, you should revise the code to properly set the amount offer. Closing this as won't fix.
- 🇮🇱Israel jsacksick
Attaching a screenshot of the admin UI so you can see that the promotion can't be saved if the amount isn't filled:
So once again a data problem to me.
- 🇩🇪Germany Umac_de
@ jsacksick
No, I am not creating promotions programatically, but, you are right, the amount is missing on the config site.
Don't know how that happened.
Thank you! - 🇮🇱Israel jsacksick
@Umac_de: weird... I believe this is a better fix, as fixing the promotion offer code just turns this bug into a silent one... Better to fix a malformed promotion that probably shouldn't be active anymore than having it silently fail IMO.