productPrice
function, since version 1.0.0
categories: product, prestashop
productPrice(productId, [combinationId], [useTax], [groupId], [currencyId], [countryId])
Calculates final product price, including tax, specific price or any reductions.
Only productId
parameter is required, other parameters are optional. If you enter 0
as a value of optional parameter, then default value will be used instead.
parameters
- productId: number - required parameter - id of product to calculate final price for
- combinationId: string - combination ID - if set, price of specific product combination will be returned.
- useTax: boolean - if true, then tax will be included in price. Default value is true
- groupId: number - id of customer group, important to retrieve specific prices
- currencyId: number - id of currency we want to retrieve product price in. It’s also important to retrieve specific prices
- countryId: number - id of country, important to retrieve specific prices
return type:
currency
examples
productPrice(product.id);
productPrice(combination.productId, combination.id, false);
productPrice(combination.productId, 0, false, 0, 2);