#Prevent gift card from being applied to shipping / possible bug?
13 messages · Page 1 of 1 (latest)
I'm also noticing that cart.gift_card_total before placing the order does not consider taxes or shipping, i.e, it doesn't apply the gift card to taxes or shipping. But order.gift_card_total being returned from order complete has a higher value, and seems to apply the gift card to taxes and shipping as well, and is often zero (if the gift card is big enough). However, the credit card is being charged based on the totals in the cart, not in the order. Should I file a bug?
Here is an example. The first image has gift card applied to $20 which is the price of the items (cart.gift_card_total). In the second image is after complete cart and the order data says it got applied to 24.86 (order.gift_card_total)
The credit card is actually charged $4.86 correctly ($2 shipping + $2.86 tax)
The gift card balance is updated after deducting 24.86. I think there are two issues:
order.gift_card_totalshould matchcart.gift_card_total(the cart is correct)- The gift card balance should be reduced by 20, not 24.86
Created defect: https://github.com/medusajs/medusa/issues/5005
I can't figure out what the rationale behind this line is in CartService.decorateTotals:
const giftCardTotal = await this.newTotalsService_.getGiftCardTotals(
cart.subtotal - cart.discount_total, // Why is this not cart.subtotal + cart.shipping_total + cart.tax_total - cart.discount_total?
{
region: cart.region,
giftCards: cart.gift_cards,
}
)
Would the gift not be applied to the whole total and not just the sub total. When customer applies a gift card they should be able to apply it on the whole total, not just bits and pieces of it. The customer applying doesn't want to pay tax, shipping etc. if the gift card can cover it.
I think this is the fix: https://github.com/medusajs/medusa/pull/5015
Any thoughts on this change by any of the maintainers?
What would happen if the product is set as non-discountable
This does not change the discount logic at all, as discount total is still being deducted. This change is specific to the amount the gift card applies to.
@proper terrace if you explain your concern more, I can perhaps address it, but since gift cards are just a method of payment, it doesn't impact discounts.
This is the change:
This actually matches the behaviour of what an Order is stored as. I’m just trying to make the cart display before the order is placed consistent.
Are we ok to merge this? Haven’t received any feedback