Selected product variant does not apply to cart | Ella theme

Highlighted
New Member
3 0 0

Hello,

 

Some of you might recognise the issue in subject from existing topics. Before I decided to come to you, I did go through them but I did not find the solution because I have different error messages in the debugging console:

 

Uncaught TypeError: Cannot read property '0' of null
at updatePricing
at Shopify.OptionSelectors.selectCallback [as onVariantSelected] 
at Shopify.OptionSelectors.updateSelectors 
at HTMLSelectElement.element.onchange

at Object.trigger (jquery.min.js?6297:3)
at HTMLSelectElement.<anonymous> (jquery.min.js?6297:3)
at Function.each (jquery.min.js?6297:2)
at n.fn.init.each (jquery.min.js?6297:2)
at n.fn.init.trigger (jquery.min.js?6297:3)
at Shopify.OptionSelectors.selectVariant

 

I started troubleshooting on product.quickview.liquid file. What is causing the problem to me is that some well experienced community members blame the jquery.cart.min.js file instead. I would really appreciate if one of you could help me point to the right direction so I can use that knowledge in the future.

 

My website: ruhatunder.hu

Reference product: rose gold patent (it is a jacket for kids)

Issue: select size 134 (or any other than the first available size on stock (110)), then add it to cart. at the end in the cart you will always have a jacket in size 110 (Same issue with all products which are available with multiple variants.)

 

PM: Jason, I am really impressed about your responses, I think you have seen this issue before from other community member

 

Thank you in advance.

 

Bela

0 Likes
New Member
3 0 0

This is what I found so far. The below code seems to be causing the issue. In Visual code it detects issue with } brackets when I run it in node js, but it does not give you any syntax error if you debug the code in liquid. 

 

        if (unitPriceTextMatch) {
            var unitPriceText = unitPriceTextMatch[0];     
            var unitPrice = unitPriceText.replace(/[.|,]/g,'');
            var quantity = parseInt($('[data-qtt-id]').val());
            var totalPrice = unitPrice * quantity;

            var totalPriceText = Shopify.formatMoney(totalPrice, window.money_format);
            
            regex = /([0-9]+[.|,][0-9]+[.|,][0-9]+)/g;     
            if (!totalPriceText.match(regex)) {
                regex = /([0-9]+[.|,][0-9]+)/g;
            } 
            totalPriceText = totalPriceText.match(regex)[0];

            var regInput = new RegExp(unitPriceText, "g"); 
            var totalPriceHtml = $('.product .price').html().replace(regInput ,totalPriceText);

            $('.product .total-price span').html(totalPriceHtml); 
        }; 

 

0 Likes
Shopify Partner
189 13 21

@becfix 

Can you please share your store URL?

Thanks & Regards
Akshay Vaghasiya

Shopify Expert | E-commerce Consultant
Email: akshayvaghasiya84@gmail.com
Skype: akshayvaghasiya84
 - Want to modify or custom changes on store hire me .
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
0 Likes

please share a store url to better assist 

Thanks & Regards
Perennial Solution

Would like to add new functionality or customize an existing one, please hire us.
If helpful then please Like and Accept Solution .
Email: infoperennialsolution@gmail.com
Skype: infoperennialsolution
0 Likes
New Member
3 0 0

Hello,

 

It is ruhatunder.hu

 

thank you for your effort.

0 Likes
Shopify Partner
189 13 21

@becfix 

I have checked and found that the updatePricing() function is not working. Moreover, check why it is not working because it is a javascript error and I need your store access to check it. If you want me to fix the issue then please let me know I will send you a store admin collaborator access request.

If you want this issue fix faster then you can contact me through email or Skype.

Thanks & Regards
Akshay Vaghasiya

Shopify Expert | E-commerce Consultant
Email: akshayvaghasiya84@gmail.com
Skype: akshayvaghasiya84
 - Want to modify or custom changes on store hire me .
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
0 Likes
Shopify Partner
189 13 21

@becfix 

Please check message.

Thanks & Regards
Akshay Vaghasiya

Shopify Expert | E-commerce Consultant
Email: akshayvaghasiya84@gmail.com
Skype: akshayvaghasiya84
 - Want to modify or custom changes on store hire me .
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
0 Likes