Skip to content

GiftCards container

The GiftCards container manages the application and removal of gift cards to the shopping cart. It provides a text box for users to enter gift card codes. The container uses the applyGiftCardToCart and removeGiftCardFromCart functions to apply the coupon to the cart. When a gift card code is applied, the corresponding amount is subtracted from the total order value, and the discount is displayed in the cart and order summary.

The Adobe Commerce merchant can manage gift card configuration from Marketing > Gift Card Accounts.

GiftCards container

GiftCards container

Configurations

The GiftCards container provides the following configuration options:

OptionTypeReq?Description
classNamestringNoCSS class applied to accordion.
accordionSectionTitlestringNoAccordion section title overriding translation.
accordionSectionIconVNodeNoCoupons section icon.
couponCodeFieldVNodeNoCoupon code input field.
applyCouponsButtonVNodeNoThe button used to apply a coupon.
errorVNodeNoAn error message
appliedCouponsVNodeNoList of applied coupon codes.
onApplyCouponfunctionNoCallback when applying a coupon code.

Example configuration

The following example demonstrates how to render the GiftCards container as part of the OrderSummary slot:

provider.render(OrderSummary, {
routeProduct: (product) => rootLink(`/products/${product.url.urlKey}/${product.topLevelSku}`),
routeCheckout: checkoutURL ? () => rootLink(checkoutURL) : undefined,
slots: {
GiftCards: (ctx) => {
const giftCards = document.createElement('div');
provider.render(GiftCards)(giftCards);
ctx.appendChild(giftCards);
},
},
})($summary);