Documentation
Feedback
Guides
VTEX IO Apps

VTEX IO Apps
Basic components
Product Price
Official extension
Version: 1.3.0
Latest version: 1.31.0

This page is about version 1.3.0 of the app, which is not the most recent version. The latest stable version is 1.31.0.

{"base64":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABCAIAAAB2XpiaAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAFUlEQVR4nGPg4+Mz1Nfjl5T7f2c+AAzxA3lptuDWAAAAAElFTkSuQmCC","img":{"src":"https://img.shields.io/badge/all_contributors-0-orange.svg?style=flat-square","width":110,"height":20,"type":"svg"}}

Product Price app is responsible for exporting blocks related to the product's price, such as list price, selling price and savings.

{"base64":"  ","img":{"width":2782,"height":1182,"type":"png","mime":"image/png","wUnits":"px","hUnits":"px","length":389736,"url":"https://user-images.githubusercontent.com/8443580/77692675-d5694180-6f85-11ea-8690-49db5be24b3d.png"}}

Configuration

Step 1 - Adding the Product Price app to your theme's dependencies

In your theme's manifest.json, add the Product Price app as a dependency:


_10
"dependencies": {
_10
"vtex.product-price": "1.x"
_10
}

Now, you can use all the blocks exported by the product-price app. Check out the full list below:

Block nameDescription
product-list-priceRenders the product list price. If it is equal to the product selling price, this block will not be rendered.
product-selling-priceRenders the product selling price.
product-spot-priceRenders the product spot price. If it is equal to the product selling price, this block will not be rendered. For more information about how to set this up in your store, check this document.
product-installmentsRenders the product installments. If more than one option is available, the one with the biggest number of installments will be displayed.
product-price-savingsRenders the product price savings, if there is any. It can show the percentage of the discount or the value of the absolute saving.
product-list-price-rangeRenders the product list price range. It follows the same logic applied to the ListPrice: if its value is equal to the product selling price, this block is not rendered.
product-selling-price-rangeThe product selling price range.

All blocks listed above use product price data fetched from the store catalog. In order to understand further, please access the Pricing Module overview.

Step 2 - Adding the Product Price's blocks to your theme's templates

To add the Product Price's blocks in your theme, you just need to declare them as children of the product-summary.shelf, exported by the Product Summary app, or declare them in the theme's Product template (store.product).

Notice the following: these blocks necessarily need a Product context in order to work properly. Therefore, when declaring them as children of the product-summary.shelf, be sure that they are in a store template in which this context is available.

For example:


_12
"shelf#home": {
_12
"blocks": ["product-summary.shelf"]
_12
},
_12
_12
"product-summary.shelf": {
_12
"children": [
_12
"product-list-price",
_12
"product-selling-price#summary",
_12
"product-price-savings",
_12
"product-installments"
_12
]
_12
},

Every block in this app only has two props in common:

Prop nameTypeDescriptionDefault value
markers[string]IDs of your choosing to identify the block's exported messages and customize them using the admin's Site Editor. Learn how to use them accessing the documentation on Using the Markers prop to customize a block's message.[]
blockClassstringBlock ID of your choosing to be used in CSS customization.undefined

For example:


_10
"product-selling-price#summary": {
_10
"props": {
_10
"markers": [
_10
"highlight"
_10
],
_10
"blockClass": "summary"
_10
}
_10
},

Step 3 - Editing the block's message on Site Editor

Every Product Price's block uses the ICU Message Format, making it possible to fully edit the text messages and the variables displayed by each block.

Access your VTEX account's admin, open the Site Editor and look for the Product Price's blocks.

{"base64":"  ","img":{"width":2288,"height":1454,"type":"gif","mime":"image/gif","wUnits":"px","hUnits":"px","length":3874251,"url":"https://user-images.githubusercontent.com/52087100/78073694-bdbffd80-7377-11ea-9262-40854dccdd53.gif"}}

Once editing their messages, bear in mind the message variables exported by each block (stated below) and the documentation on how to use the Markers prop.

  • product-list-price
Message variableTypeDescription
listPriceValuestringList price value.
listPriceWithTaxstringList price value with tax.
taxPercentagestringTax percentage.
  • product-selling-price
Message variableTypeDescription
sellingPriceValuestringSelling price value.
sellingPriceWithTaxstringSelling price with tax.
taxPercentagestringTax percentage.
  • product-spot-price
Message variableTypeDescription
spotPriceValuestringSpot price value.
  • product-installments
Message variablesTypeDescription
spotPriceValuestringSpot price value.
installmentsNumberstringNumber of installments.
installmentValuestringValue of each installment.
installmentsTotalValuestringTotal value of installments.
interestRatestringInterest rate.
hasInterestbooleanWhether the installments have interest (true) or not (false).
  • product-price-savings
Message variablesTypeDescription
previousPriceValuestringPrevious price value (list price).
newPriceValuestringNew price value (selling price).
savingsValuestringDifference between previous product price and the new one.
savingsWithTaxstringDifference between previous product price and the new one with taxes.
savingsPercentagestringPercentage of savings.
  • product-list-price-range
Message variablesTypeDescription
minPriceValuestringValue of the cheapest list price SKU.
maxPriceValuestringValue of the most expensive list price SKU.
minPriceWithTaxstringValue of the cheapest list price SKU with tax.
maxPriceWithTaxstringValue of the most expensive list price SKU with tax.
listPriceValuestringValue of the list price of the only SKU available.
listPriceWithTaxstringValue of the list price of the only SKU available with tax.
  • product-selling-price-range
Message variablesTypeDescription
minPriceValuestringValue of the cheapest selling price SKU.
maxPriceValuestringValue of the most expensive selling price SKU.
minPriceWithTaxstringValue of the cheapest selling price SKU with tax.
maxPriceWithTaxstringValue of the most expensive selling price SKU with tax.
sellingPriceValuestringValue of the selling price of the only SKU available.
sellingPriceWithTaxstringValue of the selling price of the only SKU available with tax.

In the gif example above, the block was firstly displaying a Save $224.40 message. By editing the message exported, it now renders a You are saving: $224.40 (37%) message thanks to the changes performed through the admin's Site Editor.

{"base64":"  ","img":{"width":2878,"height":1538,"type":"png","mime":"image/png","wUnits":"px","hUnits":"px","length":394651,"url":"https://user-images.githubusercontent.com/52087100/78073688-bc8ed080-7377-11ea-9a7a-53c36d9a9fe2.png"}}

Customization

To apply CSS customization in this and other blocks, follow the instructions given in the recipe on Using CSS Handles for store customization.

CSS Handles
installmentValue
installmentsNumber
installmentsTotalValue
installments
interestRate
listPrice'
listPriceRangeMaxValue
listPriceRangeMaxWithTax
listPriceRangeMinValue
listPriceRangeMinWithTax
listPriceRangeUniqueValue
listPriceRangeUniqueWithTax
listPriceRange
listPriceValue
listPriceWithTax
newPriceValue
previousPriceValue
savingsPercentage
savingsValue
savingsWithTax
savings
sellingPrice--hasListPrice
sellingPriceRangeMaxValue
sellingPriceRangeMaxWithTax
sellingPriceRangeMinValue
sellingPriceRangeMinWithTax
sellingPriceRangeUniqueValue
sellingPriceRangeUniqueWithTax
sellingPriceRange
sellingPriceValue
sellingPriceWithTax
sellingPrice
spotPriceValue
spotPrice
taxPercentage
See also
VTEX App Store
VTEX IO Apps