EVGLineItem Class Reference
| Inherits from | NSObject |
|---|---|
| Declared in | EVGItems.h |
Overview
A line item contains a single EVGItem subclass and the quantity that were ordered.
The item should be an EVGProduct. When a line item is passed to [EVGContext addToCart:],
[EVGContext removeFromCart:], [EVGContext viewCart:], or [EVGContext purchase:] and its
item is an EVGProduct, that product MUST have [EVGProduct price] set: a Product-backed
line item whose price is missing is dropped before the event is sent and an EVGLogLevelError is
logged identifying the offending product id. A line item whose item is not an EVGProduct is
not subject to this price check.
Initialization
Here is an example of how to initialize a single EVGLineItem:
EVGLineItem *lineItem = [EVGLineItem lineItemWithProductId:@"product001" productName:@"Road Runner" price:@100 quantity:@2];
item
The item being ordered, subclass of EVGItem.
@property (nonnull, nonatomic, strong) EVGItem *itemDeclared In
EVGItems.h
quantity
The quantity of the item being ordered. Defaults to 1
@property (nullable, nonatomic, strong) NSNumber *quantityDeclared In
EVGItems.h
+ lineItemWithItem:quantity:
Builds a line item which contains one or more units of a product in an order. This method only builds a data object. To
use it, pass it to one of the tracking methods like [EVGContext addToCart:].
+ (nonnull instancetype)lineItemWithItem:(nonnull EVGItem *)item quantity:(nullable NSNumber *)quantityParameters
item |
The required |
|---|---|
quantity |
The optional quantity, defaults to 1 |
Return Value
A line item which can be further modified.
Declared In
EVGItems.h
+ lineItemWithProductId:productName:price:quantity:
Builds a line item which contains one or more units of a product in an order. This method only builds a data object. To
use it, pass it to one of the tracking methods like [EVGContext addToCart:].
+ (nonnull instancetype)lineItemWithProductId:(nonnull NSString *)productId productName:(nullable NSString *)productName price:(nullable NSNumber *)price quantity:(nullable NSNumber *)quantityParameters
productId |
The ID of the product in this line item. This is the only required field. |
|---|---|
productName |
The name of the product. It should be provided whenever possible. |
price |
The unit price of the product. The revenue for this line item will be price x quantity.
REQUIRED — the SDK drops any LineItem whose Product is missing a price before sending the event
and emits an |
quantity |
The number of units of the product this line item represents. |
Return Value
A line item which can be further modified.
Declared In
EVGItems.h