I override a big part of the front of the products with JS. I would like to be able to update my price from the "Add to cart" button. Currently the price of my product in backoffice is at 1 € and I add in JS amounts in addition. See the attached screenshot:
Except that when I click on "Add to cart" the price is at 1 €.
I award my price to the price of the product like this:
function updatePrice(tabOptions) {
// Update prices options
var format = price_format_page[tabOptions['is_format_page']];
var color = price_color_page[tabOptions['is_color_page']];
var impression = price_impression_page[tabOptions['is_impression_page']];
var paper = price_paper_page[tabOptions['is_paper_page']];
var reliure = price_reliure_page[tabOptions['is_reliure_page']];
var color_reliure = price_color_reliure_page[tabOptions['is_color_reliure_page']];
var finition = price_finition_page[tabOptions['is_finition_page']];
if (tabOptions['is_color_page'] === 'Couleur') {
var page = price_per_page * tabOptions['page_value'];
} else {
var page = price_per_page_nb * tabOptions['page_value'];
}
var total_options = format + color + impression + paper + reliure + color_reliure + finition + page + productPriceTaxExcluded;
/*// Get combination prices
var combID = $('#idCombination').val();
var combination = combinationsFromController[combID];
if (typeof combination == 'undefined')
return;*/
// Set product (not the combination) base price
var basePriceWithoutTax = total_options;
var basePriceWithTax = +productPriceTaxIncluded;
var priceWithGroupReductionWithoutTax = 0;
The price of a product throughout the PrestaShop is calculated by the getPriceStatic() function defined in Product.php class which calls the getSpecificPrice() function of SpecificPrice.php class
In case you want to change the price of a product on run-time, then it will be better to override the getSpecificPrice() function of SpecificPrice.php class