cancel
Showing results for 
Search instead for 
Did you mean: 

Error: cannot call methods on priceBox prior to initialization; attempted to call method 'option'

SOLVED

Re: Error: cannot call methods on priceBox prior to initialization; attempted to call method 'option

I've had this same problem with a custom theme when on a configurable product.The issue was that the "catalog.product.related" layout block was being moved before the "product.info.price" block and I believe jquery was trying to find options for the related products and failing so never loading the configurable options.

 

The issue can be rectified if you remove/change any price-box class that appears before the configurable price. As my related products block was before the configurable price I change the related products to use a custom class of "rel-price-box" instead of "price-box".

 

The correct solution is probably to change/extend js to make the selector more specific but I've not looked that far into it.

 

Hope this helps someone Smiley Happy

Re: Error: cannot call methods on priceBox prior to initialization; attempted to call method 'option

Thank you so much for sharing your solution benjamin_smith - you saved my sanity after over 10 hours of trying to find the issue!  In my case, the issue came from the site mega menu, which had a product carousel included with the .price-box class.  Once I disabled the menu, the error was resolved.

 

So, yes, the next step is to change the css class of the price-box in the menu.  Why would you have javascript selecting an item based on class name anyway?  Seems like a bad practice to me for exactly this reason.

Re: Error: cannot call methods on priceBox prior to initialization; attempted to call method 'option

I had an item in my wishlist and it created this error.

Once I removed the item from the wishlist the tier pricing loaded again.

 

I use a codazon theme

Re: Error: cannot call methods on priceBox prior to initialization; attempted to call method 'option


@Gaboemmi wrote:

When I enter the detail of a Configurable Product as a Client user, I do not get any options in the selection input:cc1.pngHowever when I open the product for "Quick View", if I leave all the options loan against gold of the product configurable: cc2.png

Running the Firefox Web Developer Tool, I noticed that I threw the following error:cc3.png

This is happening to me with most configurable products, one that works for me, but I do not know until when.

All the things I did to try to solve it:

  1. Delete the product and re-create it.
  2. Re-indexed the system indexes.
  3. I recreated another Atribute Set.

None of this worked for me.

The version of Magento is 2.1.7

 

 

 


Thank you for asking. The solution you mentioned is very impressive, but you can improve it by reading the latest guidelines. Several points are mentioned in this Link, but you do not address them in your solution. 

 

Regards,