Gomah / nuxt-shopify

🛍 Seamless Shopify Buy SDK integration with Nuxt.js.
https://nuxt-shopify-docs.vercel.app
MIT License
352 stars 29 forks source link

Gift card #660

Open aykodesmedt opened 3 years ago

aykodesmedt commented 3 years ago

Is is currently possible to accept gift cards? A gift card code doesn't seem to work with addDiscount.

Gomah commented 3 years ago

Hey @aykodesmedt, have you tried using the following:

let checkout = await this.$shopify.checkout.create();
const giftCardCodes = ['yourGiftCardCodes', 'anotherOne'];

checkout = await this.$shopify.checkout.addGiftCards(checkout.id, giftCardCodes);

It's not document yet, but would add to the documentation / types if it works!

ref: https://github.com/Shopify/js-buy-sdk/issues/770#issuecomment-662959502

aykodesmedt commented 3 years ago

Hi @Gomah,

Yes, I've tried that. When I use the code above, I get an array in the checkout appliedGiftCards, but the subtotal or total of the cart is the same as before adding the gift card.

aykodesmedt commented 3 years ago

@Gomah

Hi! Have you been able to figure out something more about how to do this?

Gomah commented 3 years ago

@aykodesmedt Didn't get much time to look at it yet, feel free to email me with more details 👍🏻

aykodesmedt commented 3 years ago

@Gomah

This code works, but the total or subtotal parameters aren't adjusted. You should look at paymentDue for the remaining amount of money the customer will now have to pay.