Commerce.Product
ClassContains all the essential details about an item available for purchase in a Lens.
- Snapchat: not supported
- SPECS: fully supported
- Camera Kit Web: not supported
- Camera Kit Mobile: not supported
- SnapchatNot supported — Available on SPECS only
- SPECSFully supported
- Camera Kit WebNot supported — Available on SPECS only
- Camera Kit MobileNot supported — Available on SPECS only
Contains all the essential details about an item available for purchase in a Lens. When products are queried, these objects are received, which include information like the product's unique ID, its type (e.g., a non-consumable), its display name, a description, and its price. This information is crucial for presenting products to users in a Lens's store or interface.
Index
Properties
Methods
Extends
Constructors
Constructor
new Product(
id,type,displayName,description,price,iconUri?,extras?):Product
Parameters
| Parameter | Type |
|---|---|
id | string |
type | ProductType |
displayName | string |
description | string |
price | Price |
iconUri? | string |
extras? | string |
Returns
Product
Overrides
ScriptObject.constructor
Properties
description
readonlydescription:string
SPECS
A brief explanation of what the product is, its features, or its benefits. This text helps users understand what they are buying before they make a purchase.
displayName
readonlydisplayName:string
SPECS
The name of the product as it will appear to users in the store or within your Lens. It should be clear and appealing.
extras
readonlyextras:string
SPECS
Allows you to include any additional information or custom data related to the product. It can be used to store JSON-encoded strings with extra metadata that is not covered by the other standard fields. This is useful for flexible product configurations or displaying unique product attributes within your Lens.
iconUri
readonlyiconUri:string
SPECS
An optional field that provides a URI to an image file that can serve as an icon for the product. It's typically used to display a visual representation of the product within a store interface or other UI elements, helping users quickly identify and differentiate items.
id
readonlyid:string
SPECS
A unique identifier for the product of the Lens. This is a crucial piece of information for referencing the product within the commerce system and for internal tracking.
price
readonlyprice:Price
SPECS
The cost of the product, provided as a Price object. This object holds the price as a standard decimal value, along with currency and country codes, ensuring accurate and properly formatted display of prices to users.
subscriptionOfferDetails
readonlysubscriptionOfferDetails:SubscriptionOfferDetails[]
SPECS
The subscription offers available for this product. Contains one or more entries for ProductType.Subscription products and is null for other product types.
Since
Lens Scripting Version 377
type
readonlytype:ProductType
SPECS
Specifies the category of the product, which impacts how it behaves in the store.
Methods
getTypeName()
staticgetTypeName():TypeName<Product>
SPECS
Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().
Returns
TypeName<Product>
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object matches or derives from the passed in type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object is the same as other. Useful for checking if two references point to the same thing.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean