Product
A product is a CategorizedItem that can be sold to users. You can add products to LineItem objects when a user orders them.
1public class Product
2extends CategorizedItemFields
| Field | Description | Modifier and Type |
|---|---|---|
alternateId | An identifier for a product other than the one stored in Item.id. | java.lang.String |
currency | An ISO 4217 currency code for the currency of this item’s price such as USD, EUR, GBP. | java.lang.String |
inventoryCount | A count of available units. | java.lang.Integer |
listPrice | Optional field for capturing another price, such as MSRP, in order to illustrate a discount. | java.lang.Double |
price | The unit price of the product. | java.lang.Double |
priceDescription | Optional field for descriptive text for the price, such as the Sale Price. | java.lang.String |
Fields inherited from class CategorizedItem:
Fields inherited from class Item:
descriptionexpirationidimageUrllocationnamenumRatingspromotionStatepublishedratingtagsurl
price
1@Nullable
2public Double priceThe unit price of the product. The unit price is required whenever the product is part of a LineItem passed to addToCart, removeFromCart, viewCart, or purchase. The unit price is optional for non-ordering events. For instance, if the product has variable pricing, a specific price may not be available for Context.viewItem(com.evergage.android.promote.Item) events.
If there is no price for a product in a line item, the SDK drops that line item and logs an error in Logcat identifying the affected product ID. If every line item in an Order is dropped, the SDK doesn’t send the event.
Note
priceDescription
1@Nullable
2public String priceDescriptionOptional field for descriptive text for the price, such as the Sale Price.
listPrice
1@Nullable
2public Double listPriceOptional field for capturing another price, such as MSRP, in order to illustrate a discount.
currency
1@Nullable
2public String currencyAn ISO 4217 currency code for the currency of this item’s price, such as USD, EUR, GBP. If absent, the currency is assumed to be the dataset default currency.
inventoryCount
1@Nullable
2public Integer inventoryCountA count of available units. Alternatively, the value can simply be 1 or 0 to indicate that the product is available or unavailable, respectively.
alternateId
1@Nullable
2public String alternateIdAn identifier for a product other than the one stored in Item.id.
Constructors
1public Product(@NonNull
2 String id)Builds a Product with the required ID only. The product can then be further modified.
Parameters
| Parameter | Description | Required? |
|---|---|---|
id | See Item.id. | Yes |
Methods
| Method | Modifier and Type |
|---|---|
fromJSONObject(org.json.JSONObject json, java.lang.String id) | static Product |
getItemType() | String |
Methods inherited from class Item:
fromJSONObject
1public static Product fromJSONObject(org.json.JSONObject json,
2 java.lang.String id)getItemType
1public String getItemType()Specified by getItemType in class Item.
DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!
Let us know so we can improve!