Magento – Magento 2 configurable product price doesn’t change

configurable-productmagento2price

I'm using Magento 2.2.5 and for any configurable product if select different variation then product price is not changing.

Can anyone help me with this?

Best Answer

There can be multiple reasons for this, so it is hard to give you a concrete answers. Here is how I would approach the problem:

First I'd find out whether the problem is with configuration or layout/theme. To do so navigate to the configurable product view on the front-end and inspect the source of the page, look for swatch initialization JSON that looks similar to this:

"Magento_Swatches/js/swatch-renderer": {
                "jsonConfig": {"attributes":{"92":{"id":"92","code":"color","label":"Farve","options":[{"id":"2125","label":"PINK CHECK","products":["53619","53617","53618"]}],"position":"0"},"134":{"id":"134","code":"size","label":"St\u00f8rrelse","options":[{"id":"2126","label":"L ","products":["53619"]},{"id":"28","label":"S","products":["53617"]},{"id":"27","label":"M","products":["53618"]}],"position":"1"}},"template":"<%- data.price %>\u00a0kr","currencyFormat":"%s\u00a0kr","optionPrices":{"53619":{"oldPrice":{"amount":4500},"basePrice":{"amount":4500},"finalPrice":{"amount":4500}.....

As you can see at the end of the example - you have price entries under "oldPrice", "finalPrice" and so on. Verify that the type (size/color/etc) of the configurable has the actual desired price here.

Under correct circumstances whenever you select the product, the price out of this JSON will be used. If you see that the price here matches the desired price (different than other variations/parent product) but it not reflected whenever you change it via selector then you can rule out the caching/configuration/indexing/etc issues.

In this case the issue is most likely related to theme/layout.

If it is related to theme/layout - it is most likely due changed price element structure/attribute names. To verify this you can temporary switch to base template and verify whether the price changing works. If so - try restoring price related template files from the original template that worked and continue from there.

Related Topic