useCartAddGiftCard

A cart hook that helps you easily add a gift card to an existing cart

// import
import { useCartAddGiftCard } from '@backpackjs/storefront';

// instantiation
const { cartAddGiftCard, ...addGiftCardStatus } = useCartAddGiftCard();

// use
const appliedGiftCards = await cartAddGiftCard({
  giftCardCode: 'testgiftcard'
})

Last updated