Skip to content

totals.getSegment(‘giftcardaccount’) returning null

I’m about at my whits end.

I still consider myself a relative novice with Magento, but this one literally has me baffled. I’ve also tossed it around to some senior devs at my work, and they are stumped too.

Locally, I’ve been using Mark Shust’s Docker configuration setup for our sandbox. After taking over the project (the previous developer is no longer involved in the project in any capacity what-so-ever), we transitioned the client from 2.4.3 up to 2.4.5-p1. Lots of things broke with the PHP change and required module updates, but we’ve worked through them for the most part — except for their custom gift cards module.

It’s a customized module due to the fact that they run the gift cards through their own system because they are physical and not the standard virtual cards. They also have a PIN number that’s required as well. Anyway… Long story short… this is all working fine on my local Docker system — but not matter what I’ve tried, it does not 100% work on either the Staging/Prod environments. I should mention that it’s running on the Adobe Commerce Cloud system. They have been… less than helpful in trying to diagnose the whole issue let’s just say.

Here is on my local after applying a test card:
sandbox

And here it is on Staging.
staging

The amount is being deducted correctly, but as you’ll notice, the gift card itself and the ability to remove it is not appearing in the Order Summary on the right.

The problem appears to stem from the isAvailable method and the fact that totals.getSegment('giftcardaccount') && totals.getSegment('giftcardaccount').value != 0; returns nothing on Stage.

While it returns a full object on my local Sandbox. I’m… stumped.