2

I am trying to update price of product on product page. So I am updating the span of price by getting product price + my additional price, but problem is when we use custom options.

Is there any event or plugin available using which I can add our price at final even after custom option.

Thank you,

  • using event you can set product final price without custom option price. Custom option price will add additionally. – Jaimin Parikh Jul 20 '16 at 13:31
  • @JaiminParikh so any other ways to do so – Bhupendra Jadeja Jul 20 '16 at 13:33
  • using "catalog_product_get_final_price" event you can get product final price. – Jaimin Parikh Jul 20 '16 at 13:37
7

OK ! I found one solution to change the price on product page itself using Javascript:

require(["jquery","Magento_Catalog/js/price-utils"], function(jQuery,priceUtils) {

    var finalPrice=100;
    formatedPrice = priceUtils.formatPrice(parseInt(finalPrice));
    jQuery('span.price-final_price > span.price-wrapper > span.price').text(formatedPrice);
    var finalPrice=productPrice+(pricePerText*textObjects)+(pricePerImage*imageObjects);
    formatedPrice = priceUtils.formatPrice(parseInt(finalPrice));
    jQuery('span.price-final_price > span.price-wrapper > span.price').text(formatedPrice);
}); // Required
  • it is a good solution but i can't able to add my currency symbol before the formatted price could you suggest me? – Nagaraju K Feb 3 '17 at 5:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.