Change the product description on variant selection with theme: pipeline

Change the product description on variant selection with theme: pipeline

koakaya
New Member
4 0 0

I'm trying to follow this procedure:

https://docs.minionmade.com/shopify/change-description-based-on-variant-selected-in-shopify 

 

But I understand that 

var selectCallback  is not the right way to go with the theme pipeline. 

 

I''m not sure how to fix it.

 

I've added the following lines at the end of product.liquid and it doesn't work.

 

<script>
var selectCallback = function(variant, selector) {

$('.description').css('display', 'none');
$('#' + variant.id).css('display', 'block');

}
</script>

 

For my product description, I was able to add the HTML with my proper product Variant ID

 

<p class="description" id="44036369187116">Description for variant 1</p>
<p class="description" id="44036369219884" style="display: none;">Description for variant 2</p>

 

Any idea how I can fix this?

Replies 3 (3)

Guleria
Shopify Partner
4111 804 1155

Hello @koakaya ,

 

 

First thing, this is an old way to add the variant description.  
To add description with variant you can use variant metafield.

 

Once you will add it then within the code you have to call it ( you can call all at same time within the loop ) and then with the help of JS show/hide a/to the selected variant. 


 

- Custom themes, UI/UX design, ongoing maintenance & support.
- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder
koakaya
New Member
4 0 0

ok, i've included metafields instead for my variants... but now how do I trigger to display the metafield variant on selection?

defp
Tourist
3 0 0

This is my issue as well! someone help