Reference documentation and code samples for the Google Cloud Recommendation Engine V1beta1 Client class ProductDetail.
Detailed product information associated with a user event.
Generated from protobuf messagegoogle.cloud.recommendationengine.v1beta1.ProductDetail
Namespace
Google \ Cloud \ RecommendationEngine \ V1beta1
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ id
string
Required. Catalog item ID. UTF-8 encoded string with a length limit of 128 characters.
↳ currency_code
string
Optional. Currency code for price/costs. Use three-character ISO-4217 code. Required only if originalPrice or displayPrice is set.
↳ original_price
float
Optional. Original price of the product. If provided, this will override the original price in Catalog for this product.
↳ display_price
float
Optional. Display price of the product (e.g. discounted price). If provided, this will override the display price in Catalog for this product.
↳ stock_state
int
Optional. Item stock state. If provided, this overrides the stock state in Catalog for items in this event.
↳ quantity
int
Optional. Quantity of the product associated with the user event. For example, this field will be 2 if two products are added to the shopping cart foradd-to-cartevent. Required foradd-to-cart,add-to-list,remove-from-cart,checkout-start,purchase-complete,refundevent types.
↳ available_quantity
int
Optional. Quantity of the products in stock when a user event happens. Optional. If provided, this overrides the available quantity in Catalog for this event. and can only be set ifstock_statusis set toIN_STOCK. Note that if an item is out of stock, you must set thestock_statefield to beOUT_OF_STOCK. Leaving this field unspecified / as zero is not sufficient to mark the item out of stock.
Optional. Extra features associated with a product in the user event.
getId
Required. Catalog item ID. UTF-8 encoded string with a length limit of 128
characters.
Returns
Type
Description
string
setId
Required. Catalog item ID. UTF-8 encoded string with a length limit of 128
characters.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getCurrencyCode
Optional. Currency code for price/costs. Use three-character ISO-4217
code. Required only if originalPrice or displayPrice is set.
Returns
Type
Description
string
setCurrencyCode
Optional. Currency code for price/costs. Use three-character ISO-4217
code. Required only if originalPrice or displayPrice is set.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getOriginalPrice
Optional. Original price of the product. If provided, this will override
the original price in Catalog for this product.
Returns
Type
Description
float
setOriginalPrice
Optional. Original price of the product. If provided, this will override
the original price in Catalog for this product.
Parameter
Name
Description
var
float
Returns
Type
Description
$this
getDisplayPrice
Optional. Display price of the product (e.g. discounted price). If
provided, this will override the display price in Catalog for this product.
Returns
Type
Description
float
setDisplayPrice
Optional. Display price of the product (e.g. discounted price). If
provided, this will override the display price in Catalog for this product.
Parameter
Name
Description
var
float
Returns
Type
Description
$this
getStockState
Optional. Item stock state. If provided, this overrides the stock state
in Catalog for items in this event.
Returns
Type
Description
int
setStockState
Optional. Item stock state. If provided, this overrides the stock state
in Catalog for items in this event.
Parameter
Name
Description
var
int
Returns
Type
Description
$this
getQuantity
Optional. Quantity of the product associated with the user event. For
example, this field will be 2 if two products are added to the shopping
cart foradd-to-cartevent. Required foradd-to-cart,add-to-list,remove-from-cart,checkout-start,purchase-complete,refundevent
types.
Returns
Type
Description
int
setQuantity
Optional. Quantity of the product associated with the user event. For
example, this field will be 2 if two products are added to the shopping
cart foradd-to-cartevent. Required foradd-to-cart,add-to-list,remove-from-cart,checkout-start,purchase-complete,refundevent
types.
Parameter
Name
Description
var
int
Returns
Type
Description
$this
getAvailableQuantity
Optional. Quantity of the products in stock when a user event happens.
Optional. If provided, this overrides the available quantity in Catalog for
this event. and can only be set ifstock_statusis set toIN_STOCK.
Note that if an item is out of stock, you must set thestock_statefield
to beOUT_OF_STOCK. Leaving this field unspecified / as zero is not
sufficient to mark the item out of stock.
Returns
Type
Description
int
setAvailableQuantity
Optional. Quantity of the products in stock when a user event happens.
Optional. If provided, this overrides the available quantity in Catalog for
this event. and can only be set ifstock_statusis set toIN_STOCK.
Note that if an item is out of stock, you must set thestock_statefield
to beOUT_OF_STOCK. Leaving this field unspecified / as zero is not
sufficient to mark the item out of stock.
Parameter
Name
Description
var
int
Returns
Type
Description
$this
getItemAttributes
Optional. Extra features associated with a product in the user event.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Google Cloud Recommendation Engine V1beta1 Client - Class ProductDetail (0.8.2)\n\nVersion latestkeyboard_arrow_down\n\n- [0.8.2 (latest)](/php/docs/reference/cloud-recommendations-ai/latest/V1beta1.ProductDetail)\n- [0.8.1](/php/docs/reference/cloud-recommendations-ai/0.8.1/V1beta1.ProductDetail)\n- [0.7.7](/php/docs/reference/cloud-recommendations-ai/0.7.7/V1beta1.ProductDetail)\n- [0.6.4](/php/docs/reference/cloud-recommendations-ai/0.6.4/V1beta1.ProductDetail)\n- [0.5.0](/php/docs/reference/cloud-recommendations-ai/0.5.0/V1beta1.ProductDetail)\n- [0.4.12](/php/docs/reference/cloud-recommendations-ai/0.4.12/V1beta1.ProductDetail) \n| **Beta**\n|\n|\n| This library is covered by the [Pre-GA Offerings Terms](/terms/service-terms#1)\n| of the Terms of Service. Pre-GA libraries might have limited support,\n| and changes to pre-GA libraries might not be compatible with other pre-GA versions.\n| For more information, see the\n[launch stage descriptions](/products#product-launch-stages). \nReference documentation and code samples for the Google Cloud Recommendation Engine V1beta1 Client class ProductDetail.\n\nDetailed product information associated with a user event.\n\nGenerated from protobuf message `google.cloud.recommendationengine.v1beta1.ProductDetail`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ RecommendationEngine \\\\ V1beta1\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getId\n\nRequired. Catalog item ID. UTF-8 encoded string with a length limit of 128\ncharacters.\n\n### setId\n\nRequired. Catalog item ID. UTF-8 encoded string with a length limit of 128\ncharacters.\n\n### getCurrencyCode\n\nOptional. Currency code for price/costs. Use three-character ISO-4217\ncode. Required only if originalPrice or displayPrice is set.\n\n### setCurrencyCode\n\nOptional. Currency code for price/costs. Use three-character ISO-4217\ncode. Required only if originalPrice or displayPrice is set.\n\n### getOriginalPrice\n\nOptional. Original price of the product. If provided, this will override\nthe original price in Catalog for this product.\n\n### setOriginalPrice\n\nOptional. Original price of the product. If provided, this will override\nthe original price in Catalog for this product.\n\n### getDisplayPrice\n\nOptional. Display price of the product (e.g. discounted price). If\nprovided, this will override the display price in Catalog for this product.\n\n### setDisplayPrice\n\nOptional. Display price of the product (e.g. discounted price). If\nprovided, this will override the display price in Catalog for this product.\n\n### getStockState\n\nOptional. Item stock state. If provided, this overrides the stock state\nin Catalog for items in this event.\n\n### setStockState\n\nOptional. Item stock state. If provided, this overrides the stock state\nin Catalog for items in this event.\n\n### getQuantity\n\nOptional. Quantity of the product associated with the user event. For\nexample, this field will be 2 if two products are added to the shopping\ncart for `add-to-cart` event. Required for `add-to-cart`, `add-to-list`,\n`remove-from-cart`, `checkout-start`, `purchase-complete`, `refund` event\ntypes.\n\n### setQuantity\n\nOptional. Quantity of the product associated with the user event. For\nexample, this field will be 2 if two products are added to the shopping\ncart for `add-to-cart` event. Required for `add-to-cart`, `add-to-list`,\n`remove-from-cart`, `checkout-start`, `purchase-complete`, `refund` event\ntypes.\n\n### getAvailableQuantity\n\nOptional. Quantity of the products in stock when a user event happens.\n\nOptional. If provided, this overrides the available quantity in Catalog for\nthis event. and can only be set if `stock_status` is set to `IN_STOCK`.\nNote that if an item is out of stock, you must set the `stock_state` field\nto be `OUT_OF_STOCK`. Leaving this field unspecified / as zero is not\nsufficient to mark the item out of stock.\n\n### setAvailableQuantity\n\nOptional. Quantity of the products in stock when a user event happens.\n\nOptional. If provided, this overrides the available quantity in Catalog for\nthis event. and can only be set if `stock_status` is set to `IN_STOCK`.\nNote that if an item is out of stock, you must set the `stock_state` field\nto be `OUT_OF_STOCK`. Leaving this field unspecified / as zero is not\nsufficient to mark the item out of stock.\n\n### getItemAttributes\n\nOptional. Extra features associated with a product in the user event.\n\n### hasItemAttributes\n\n### clearItemAttributes\n\n### setItemAttributes\n\nOptional. Extra features associated with a product in the user event."]]