0

I have a problem with my site. When i select a swatch on mobile, the price of the product doesn't change. This is only a problem on the mobile version of the site and not present on the desktop version.

I get the following error: cannot call methods on priceBox prior to initialization; attempted to call method 'option'

1

I have found a sollution to the problem.

Make a new folder in your theme directory called: Magento_configurableProduct/view/frontend/web/js

And put the following file in the directory: configurable.js

Copy the file contents from the magento vendor directory(vendor/magento/module-configurable-product/view/frontend/web/js/configurable.js) in the new file you just made.

Replace the below code under the _initializeOptions: function () {

priceBoxOptions = $(this.options.priceHolderSelector).priceBox().priceBox('option',  'openOnFocus', true).priceConfig || null;

Hope this helps someone.

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.