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');

Remove

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

Gift card balance is deducted atomically at checkout. Concurrent checkouts cannot double-spend the same gift card.

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