Why won't my SKU's update with the custom Class styling I have added?

New Member
14 0 0

Hey everybody. I have my product SKU's updating with the variant selection as intended. However I am over-writing some styling in the <p Class> and it isn't displaying how I would expect.

 

Here's the code I'm using:

 

{% assign current_variant = product.selected_or_first_available_variant %}
{% if current_variant.sku %}
<p id="Sku-{{ section_id }}" class="product-single__sku" style="font-size: 11px">
SKU: {{ current_variant.sku }} | UPC: {{ current_variant.barcode }}
</p>
{% endif %}

 

Here's a video of the display on my website. You'll notice that the custom code I have to display the SKU and UPC go away after you select the first variant. Also you'll notice it gets rid of the "My Price" beside the product price.

 

Any thoughts??

 

0 Likes
Highlighted
Shopify Partner
1386 163 253

This happens because the whole snippet is being replaced using JavaScript and AJAX on variant selection, whereas your code is running on backend and only executes at page refresh.

Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog
0 Likes
Highlighted
New Member
14 0 0

Yikes, that sounds intense. Any suggestions on where I can start looking? I don't mind doing the research and learning for myself. But your reply is like a foreign language, LOL. Where can I start to learn about Java and Ajax in regards to Shopify Liquid.

0 Likes