WrCartContext
webround-docs / WrCartContext
Interface: WrCartContext
Defined in: wr.d.ts:1192
The checkout cart context — manages delivery selections, addresses, shipping, invoicing, and the checkout flow.
Available as wr.cart in every custom component.
Only meaningful inside the Cart/Checkout page.
Example
const { shipping, cartTotalGross, selectedShippingAddress } = wr.cart;
Properties
availableItems
availableItems:
WrCartItem[]
Defined in: wr.d.ts:1218
Cart items that are available and shippable
cartTotalGross
cartTotalGross:
number
Defined in: wr.d.ts:1208
Cart total (gross, with tax)
cartTotalNet
cartTotalNet:
number
Defined in: wr.d.ts:1210
Cart total (net, before tax)
computedItems
computedItems:
WrCartItem[]
Defined in: wr.d.ts:1216
All cart items with computed pricing and delivery info
customerEmail
customerEmail:
string
Defined in: wr.d.ts:1194
Customer email for guest checkout
deliverySelections
deliverySelections:
Record<string,WrDeliveryMethod>
Defined in: wr.d.ts:1196
Delivery method selected per variant ID
orderDeliveryMethod
orderDeliveryMethod:
string
Defined in: wr.d.ts:1202
Currently selected shipping method ID
requestsInvoice
requestsInvoice:
boolean
Defined in: wr.d.ts:1206
Whether the customer requests a VAT invoice
selectedBillingAddress
selectedBillingAddress:
WrAddress
Defined in: wr.d.ts:1200
Selected billing address
selectedShippingAddress
selectedShippingAddress:
WrAddress
Defined in: wr.d.ts:1198
Selected shipping address
shipping
shipping:
WrShipping
Defined in: wr.d.ts:1212
Resolved shipping options for the current cart and address
useBillingAsShipping
useBillingAsShipping:
boolean
Defined in: wr.d.ts:1204
Whether billing address should be used as shipping address
validatedCoupons
validatedCoupons:
WrValidatedCoupon[]
Defined in: wr.d.ts:1214
Applied and validated coupon codes
Methods
clearElement()
clearElement(
itemId):void
Defined in: wr.d.ts:1223
Remove an item's delivery selection.
Parameters
itemId
string
Returns
void
handleCheckout()
handleCheckout():
Promise<any>
Defined in: wr.d.ts:1238
Proceed to checkout. In the hosted website this triggers the Stripe payment flow.
Returns
Promise<any>
Example
await wr.cart.handleCheckout()
setCustomerEmail()
setCustomerEmail(
void
Defined in: wr.d.ts:1225
Set the customer email (for guest checkout).
Parameters
email
string
Returns
void
setDeliveryMethod()
setDeliveryMethod(
itemId,method):void
Defined in: wr.d.ts:1221
Set the delivery method for a specific cart item.
Parameters
itemId
string
method
Returns
void
setOrderDeliveryMethod()
setOrderDeliveryMethod(
methodId):void
Defined in: wr.d.ts:1231
Select a shipping method by ID.
Parameters
methodId
string
Returns
void
setSelectedBillingAddress()
setSelectedBillingAddress(
addr):void
Defined in: wr.d.ts:1229
Set the billing address for the order.
Parameters
addr
Returns
void
setSelectedShippingAddress()
setSelectedShippingAddress(
addr):void
Defined in: wr.d.ts:1227
Set the shipping address for the order.
Parameters
addr
Returns
void
setUseBillingAsShipping()
setUseBillingAsShipping(
flag):void
Defined in: wr.d.ts:1233
Toggle whether the billing address is also used as the shipping address.
Parameters
flag
boolean
Returns
void