Behio Storefront SDK
Cart & Checkout

Discounts & Gift Cards

Apply discount codes and gift cards to the cart

Discount Codes

Apply

const cart = await client.cart.applyDiscount('SUMMER20');

Remove

const cart = await client.cart.removeDiscount();

Discount Types

TypeDescription
PERCENTAGEPercentage off subtotal (e.g. 20%)
FIXED_AMOUNTFixed amount off (e.g. 100 CZK)
FREE_SHIPPINGFree shipping

Discounts are validated server-side: expiration, usage limits, minimum order amount.

Gift Cards

Check Balance First

const { valid, balance, currency } = await client.catalog.checkGiftCard('GC-ABCD-EFGH-IJKL');

Apply to Cart

const cart = await client.cart.applyGiftCard('GC-ABCD-EFGH-IJKL');
// A cart can hold several gift cards, call applyGiftCard again with another code.
cart.giftCards; // [{ code, balance, currency }, ...] applied cards + balances

Remove

// Remove one specific applied card by its code.
const cart = await client.cart.removeGiftCard('GC-ABCD-EFGH-IJKL');

Multiple gift cards can be applied to one cart. At checkout they are consumed in the order they were added, and each covers min(its balance, the remaining due), so the last card is spent partially and its leftover balance stays on the card. Balances are deducted atomically; concurrent checkouts cannot double-spend.

Combining Discounts

You can combine a discount code and a gift card on the same order. The discount is applied to the subtotal first, then the gift card covers the remaining amount.

On this page