Types: BundleMode to CartLineState
The types of @poltura/theme-sdk/cart, BundleMode to CartLineState.
Ezen az oldalon
import { … } from '@poltura/theme-sdk/cart';BundleMode
How a bundle in the cart was put together.
type BundleMode = 'addOn' | 'fixed' | 'fbt' | 'bxgy'BundlePriceReview
A bundle price the shop changed since the shopper added the bundle, which they must accept before paying.
needsReviewrequiredbooleanWhether a changed bundle price waits for the shopper's approval.
proposedTotalrequiredMoney | nullThe new total of the changed bundles, or null while it is not known.
loadingrequiredbooleanWhether the new price is loading.
acceptingrequiredbooleanWhether the approval is being sent.
failedrequiredbooleanWhether the last approval failed.
acceptrequired() => Promise<void>Accepts the new price; the cart reloads with it.
Cart
The shopper's cart.
idrequiredstringThe cart's id.
currencyCoderequiredCurrencyCodeThe cart's currency.
linesrequiredreadonly CartLine[]The lines, with bundle components folded under their bundle.
itemCountrequirednumberHow many units the cart holds.
totalsrequiredCartTotalsWhat the cart adds up to.
codesrequiredreadonly CartCode[]The discount codes the shopper entered.
giftCardsrequiredreadonly CartGiftCard[]The gift cards applied.
minimumOrderrequiredMinimumOrder | nullThe minimum order value not reached yet, or null.
checkoutBlockedrequiredbooleanWhether checkout is blocked until the shopper fixes the cart.
CartAddInput
What to add to the cart.
variantIdrequiredstringThe variant to add.
quantitynumberHow many units; 1 when omitted.
personalizationReadonly<Record<string, string>>The shopper's personalisation texts by field key.
CartCode
A discount code the shopper entered.
coderequiredstringThe code as entered.
statusrequiredCartCodeStatusWhether it takes effect.
messagerequiredstring | nullWhat a pending code waits for or why it does not apply, in the page language; null when applied.
tonerequired'success' | 'info' | 'warning'The tone to show `message` in.
CartCodeStatus
Whether an entered code takes effect: now, once a checkout fact is known, or not at all.
type CartCodeStatus = 'applied' | 'pending' | 'notApplicable'CartError
A failed cart action, with a message ready to show.
coderequiredCartErrorCodeWhy it failed.
messagerequiredstringThe reason in the page language.
CartErrorCode
Why a cart action failed.
type CartErrorCode = 'outOfStock' | 'limitReached' | 'codeExpired' | 'codeUsedUp' | 'codeInvalid' | 'codeRejected' | 'notInCart' | 'unknown'CartGiftCard
A gift card applied to the cart.
idrequiredstringThe applied card's id; pass it to `removeGiftCard`.
kindrequired'amount' | 'product'Whether the card carries an amount or redeems for a product.
last4requiredstringThe card code's last four characters.
appliedrequiredMoneyThe credit this order uses.
balanceAfterrequiredMoneyWhat stays on the card after this order; zero for a product card.
productTitlerequiredstring | nullThe product a product card redeems for, or null.
CartLine
One line of the cart, with the bundle components folded under it.
idrequiredstringThe line's id; pass it to the cart actions.
productIdrequiredstringThe product's id.
variantIdrequiredstringThe variant's id.
titlerequiredstringThe product's title.
variantTitlerequiredstring | nullThe variant's title, or null for a single-variant product.
hrefrequiredstring | nullThe product page's path, or null when the product has no page.
imagerequiredMediaImageRef | nullThe line's image, or null.
quantityrequirednumberHow many units are in the cart.
unitPricerequiredMoneyThe price of one unit as charged.
totalrequiredMoneyThe line total as charged.
compareAtTotalrequiredMoney | nullThe line total before discounts, or null when nothing was discounted.
netUnitPricerequiredMoney | nullThe price of one unit without tax, or null when the market has no tax split.
netTotalrequiredMoney | nullThe line total without tax, or null when the market has no tax split.
availabilityrequiredAvailabilityWhether the quantity can still be bought.
preorderrequiredCartLinePreorder | nullThe delivery promise of a pre-order line, otherwise null.
isDigitalrequiredbooleanWhether the item is delivered digitally.
personalizationrequiredreadonly CartLinePersonalization[]What the shopper entered to personalise the item.
giftCardDeliveryrequiredCartLineGiftCardDelivery | nullWho a gift card line goes to and when, or null for any other line.
bundlerequiredCartLineBundle | nullThe bundle the line belongs to, or null.
componentsrequiredreadonly CartLine[]The bundle components folded under this line.
staterequiredCartLineStateWhether the line is being changed.
CartLineBundle
The bundle a cart line belongs to.
groupIdrequiredstringThe id shared by every line of this bundle in the cart.
bundleIdrequiredstringThe bundle's id.
titlerequiredstringThe bundle's title.
moderequiredBundleModeHow the bundle was put together: add-on, fixed kit, bought together, or buy X get Y.
itemCountrequirednumberHow many items the bundle holds.
compareAtrequiredMoney | nullThe bundle's price before its discount, or null.
CartLineGiftCardDelivery
Who a gift card in the cart goes to and when it is sent.
forSelfrequiredbooleanWhether the shopper buys the card for themselves.
recipientNamerequiredstring | nullThe recipient's name, or null.
recipientEmailrequiredstring | nullThe recipient's email address, or null when the card is for the shopper.
sendAtrequiredstring | nullThe day the card is sent as `YYYY-MM-DD`, or null when it is sent with the order.
CartLinePersonalization
A text the shopper entered to personalise a cart line, with the field's label.
labelrequiredstringThe field's label in the page language.
valuerequiredstringWhat the shopper entered.
CartLinePreorder
The delivery date a shopper agrees to by ordering a pre-order line.
expectedrequiredExpectedDateWhen the item is expected to ship.
messagerequiredstring | nullThe merchant's note to pre-order buyers in the page language, or null.
CartLineState
Whether a cart line is being changed and what went wrong with the last change.
updatingrequiredbooleanA quantity change is in flight.
removingrequiredbooleanA removal is in flight.
errorrequiredstring | nullWhy the last change failed, in the page language, or null.