BUYCart Class Reference

Inherits from NSObject
Conforms to BUYSerializable
Declared in BUYCart.h

Overview

The BUYCart is the starting point for the Checkout API. You are responsible for building a cart, then transforming it into a BUYCheckout using the BUYDataClient.

  lineItems

Array of BUYCartLineItem objects in the cart Note: These are different from BUYLineItem objects in that the line item objects do include the BUYProductVariant.

@property (nonatomic, strong, readonly, nonnull) NSArray<BUYCartLineItem*> *lineItems

Declared In

BUYCart.h

– isValid

Returns true if the cart is acceptable to send to Shopify.

- (BOOL)isValid

Declared In

BUYCart.h

– clearCart

Empties the cart and any custom-stored propreties.

- (void)clearCart

Declared In

BUYCart.h

– addVariant:

Adds a BUYCartLineItem to the BUYCart with the given BUYProductVariant object on it. If the associated BUYCartLineItem exists, that BUYCartLineItem’s quantity is increased by one.

- (void)addVariant:(nonnull BUYProductVariant *)variant

Parameters

variant

The BUYProductVariant to add to the BUYCart or increase by one quantity

Declared In

BUYCart.h

– removeVariant:

Removes the BUYCartLineItem from the BUYCart associated with the given BUYProductVariant object. If the associated BUYCartLineItem exists, that BUYCartLineItem’s quantity is decreased by one.

- (void)removeVariant:(nonnull BUYProductVariant *)variant

Parameters

variant

The BUYProductVariant to remove from the BUYCart or decrease by one quantity

Declared In

BUYCart.h

– setVariant:withTotalQuantity:

Adds a BUYCartLineItem with a set quantity to the BUYCart with the given BUYProductVariant object on it. If the associated BUYCartLineItem exists, that BUYCartLineItem’s quantity is overriden with the quantity specificed. If the quantity is 0 the associated BUYCartLineItem is removed from lineItems.

- (void)setVariant:(nonnull BUYProductVariant *)variant withTotalQuantity:(NSInteger)quantity

Parameters

variant

The BUYProductVariant to add to the BUYCart with a quantity

quantity

The quantity for the BUYCartLineItem associated with the BUYProductVariant

Declared In

BUYCart.h