# Google Cloud Retail V2 Client - Class PriceInfo (2.5.3)

2.5.3 (latest) 2.5.2 2.4.0 2.3.1 2.2.1 2.1.3 2.0.0 1.7.0 1.6.4 1.5.0 1.4.2 1.3.1 1.2.1 1.1.1 1.0.1 Reference documentation and code samples for the Google Cloud Retail V2 Client class PriceInfo.

The price information of a [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product).

Generated from protobuf message `google.cloud.retail.v2.PriceInfo`

## Namespace

Google \\ Cloud \\ Retail \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ currency_code` | `string` The 3-letter currency code defined in [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html). If this field is an unrecognizable currency code, an INVALID_ARGUMENT error is returned. The [Product.Type.VARIANT](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product.Type#_Google_Cloud_Retail_V2_Product_Type__VARIANT) [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product)s with the same [Product.primary_product_id](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product#_Google_Cloud_Retail_V2_Product__getPrimaryProductId__) must share the same [currency_code](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getCurrencyCode__). Otherwise, a FAILED_PRECONDITION error is returned. |
| `↳ price` | `float` Price of the product. Google Merchant Center property [price](https://support.google.com/merchants/answer/6324371). Schema.org property [Offer.price](https://schema.org/price). |
| `↳ original_price` | `float` Price of the product without any discount. If zero, by default set to be the [price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPrice__). If set, [original_price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getOriginalPrice__) should be greater than or equal to [price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPrice__), otherwise an INVALID_ARGUMENT error is thrown. |
| `↳ cost` | `float` The costs associated with the sale of a particular product. Used for gross profit reporting. \* \* Profit = [price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPrice__) - [cost](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getCost__) Google Merchant Center property [cost_of_goods_sold](https://support.google.com/merchants/answer/9017895). |
| `↳ price_effective_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` The timestamp when the [price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPrice__) starts to be effective. This can be set as a future timestamp, and the [price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPrice__) is only used for search after [price_effective_time](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPriceEffectiveTime__). If so, the [original_price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getOriginalPrice__) must be set and [original_price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getOriginalPrice__) is used before [price_effective_time](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPriceEffectiveTime__). Do not set if [price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPrice__) is always effective because it will cause additional latency during search. |
| `↳ price_expire_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` The timestamp when the [price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPrice__) stops to be effective. The [price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPrice__) is used for search before [price_expire_time](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPriceExpireTime__). If this field is set, the [original_price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getOriginalPrice__) must be set and [original_price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getOriginalPrice__) is used after [price_expire_time](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPriceExpireTime__). Do not set if [price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPrice__) is always effective because it will cause additional latency during search. |
| `↳ price_range` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo.PriceRange` Output only. The price range of all the child [Product.Type.VARIANT](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product.Type#_Google_Cloud_Retail_V2_Product_Type__VARIANT) [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product)s grouped together on the [Product.Type.PRIMARY](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product.Type#_Google_Cloud_Retail_V2_Product_Type__PRIMARY) [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product). Only populated for [Product.Type.PRIMARY](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product.Type#_Google_Cloud_Retail_V2_Product_Type__PRIMARY) [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product)s. Note: This field is OUTPUT_ONLY for [ProductService.GetProduct](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__getProduct__). Do not set this field in API requests. |

### getCurrencyCode

The 3-letter currency code defined in [ISO
4217](https://www.iso.org/iso-4217-currency-codes.html).

If this field is an unrecognizable currency code, an INVALID_ARGUMENT
error is returned.
The [Product.Type.VARIANT](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product.Type#_Google_Cloud_Retail_V2_Product_Type__VARIANT)
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product)s with the same
[Product.primary_product_id](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product#_Google_Cloud_Retail_V2_Product__getPrimaryProductId__)
must share the same
[currency_code](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getCurrencyCode__). Otherwise,
a FAILED_PRECONDITION error is returned.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setCurrencyCode

The 3-letter currency code defined in [ISO
4217](https://www.iso.org/iso-4217-currency-codes.html).

If this field is an unrecognizable currency code, an INVALID_ARGUMENT
error is returned.
The [Product.Type.VARIANT](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product.Type#_Google_Cloud_Retail_V2_Product_Type__VARIANT)
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product)s with the same
[Product.primary_product_id](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product#_Google_Cloud_Retail_V2_Product__getPrimaryProductId__)
must share the same
[currency_code](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getCurrencyCode__). Otherwise,
a FAILED_PRECONDITION error is returned.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPrice

Price of the product.

Google Merchant Center property
[price](https://support.google.com/merchants/answer/6324371). Schema.org
property [Offer.price](https://schema.org/price).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `float` |   |

### setPrice

Price of the product.

Google Merchant Center property
[price](https://support.google.com/merchants/answer/6324371). Schema.org
property [Offer.price](https://schema.org/price).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `float` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getOriginalPrice

Price of the product without any discount. If zero, by default set to be
the [price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPrice__). If set,
[original_price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getOriginalPrice__) should be
greater than or equal to [price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPrice__),
otherwise an INVALID_ARGUMENT error is thrown.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `float` |   |

### setOriginalPrice

Price of the product without any discount. If zero, by default set to be
the [price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPrice__). If set,
[original_price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getOriginalPrice__) should be
greater than or equal to [price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPrice__),
otherwise an INVALID_ARGUMENT error is thrown.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `float` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCost

The costs associated with the sale of a particular product. Used for gross
profit reporting.

- Profit = [price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPrice__) - [cost](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getCost__) Google Merchant Center property [cost_of_goods_sold](https://support.google.com/merchants/answer/9017895).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `float` |   |

### setCost

The costs associated with the sale of a particular product. Used for gross
profit reporting.

- Profit = [price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPrice__) - [cost](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getCost__) Google Merchant Center property [cost_of_goods_sold](https://support.google.com/merchants/answer/9017895).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `float` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPriceEffectiveTime

The timestamp when the [price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPrice__)
starts to be effective. This can be set as a future timestamp, and the
[price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPrice__) is only used for search
after
[price_effective_time](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPriceEffectiveTime__).

If so, the
[original_price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getOriginalPrice__) must be
set and [original_price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getOriginalPrice__)
is used before
[price_effective_time](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPriceEffectiveTime__).
Do not set if [price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPrice__) is always
effective because it will cause additional latency during search.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasPriceEffectiveTime

### clearPriceEffectiveTime

### setPriceEffectiveTime

The timestamp when the [price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPrice__)
starts to be effective. This can be set as a future timestamp, and the
[price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPrice__) is only used for search
after
[price_effective_time](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPriceEffectiveTime__).

If so, the
[original_price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getOriginalPrice__) must be
set and [original_price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getOriginalPrice__)
is used before
[price_effective_time](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPriceEffectiveTime__).
Do not set if [price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPrice__) is always
effective because it will cause additional latency during search.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPriceExpireTime

The timestamp when the [price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPrice__)
stops to be effective. The [price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPrice__)
is used for search before
[price_expire_time](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPriceExpireTime__). If
this field is set, the
[original_price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getOriginalPrice__) must be
set and [original_price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getOriginalPrice__)
is used after
[price_expire_time](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPriceExpireTime__).

Do not set if [price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPrice__) is always
effective because it will cause additional latency during search.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasPriceExpireTime

### clearPriceExpireTime

### setPriceExpireTime

The timestamp when the [price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPrice__)
stops to be effective. The [price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPrice__)
is used for search before
[price_expire_time](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPriceExpireTime__). If
this field is set, the
[original_price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getOriginalPrice__) must be
set and [original_price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getOriginalPrice__)
is used after
[price_expire_time](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPriceExpireTime__).

Do not set if [price](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo#_Google_Cloud_Retail_V2_PriceInfo__getPrice__) is always
effective because it will cause additional latency during search.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPriceRange

Output only. The price range of all the child
[Product.Type.VARIANT](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product.Type#_Google_Cloud_Retail_V2_Product_Type__VARIANT)
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product)s grouped together on the
[Product.Type.PRIMARY](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product.Type#_Google_Cloud_Retail_V2_Product_Type__PRIMARY)
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product). Only populated for
[Product.Type.PRIMARY](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product.Type#_Google_Cloud_Retail_V2_Product_Type__PRIMARY)
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product)s.

Note: This field is OUTPUT_ONLY for
[ProductService.GetProduct](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__getProduct__).
Do not set this field in API requests.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo.PriceRange|null` |   |

### hasPriceRange

### clearPriceRange

### setPriceRange

Output only. The price range of all the child
[Product.Type.VARIANT](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product.Type#_Google_Cloud_Retail_V2_Product_Type__VARIANT)
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product)s grouped together on the
[Product.Type.PRIMARY](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product.Type#_Google_Cloud_Retail_V2_Product_Type__PRIMARY)
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product). Only populated for
[Product.Type.PRIMARY](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product.Type#_Google_Cloud_Retail_V2_Product_Type__PRIMARY)
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product)s.

Note: This field is OUTPUT_ONLY for
[ProductService.GetProduct](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__getProduct__).
Do not set this field in API requests.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PriceInfo.PriceRange` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |