Change Product Description for Different Product Variant

Change Product Description for Different Product Variant

epoll24
Explorer
54 0 9

Hi I'm trying to change the description text for different variants of my product. I have two different variants but each variant includes different items so I want to be able to have different text in the description/what's included text. My website is PulseDevice.com and I'm using Impact Theme. 

Screenshot 2024-05-02 at 11.47.25 PM.png

Replies 6 (6)

PaulNewton
Shopify Partner
7746 679 1612

To have dynamic descriptions per variant you will either need to pay for an app or customize your theme.

Though some themes may re-render the product-information section when a variant changes which can let you use metafields directly to achieve this.

In the admin for the content try making a test variant metafield definition holding a test description.

Then in the theme reference the variant metafield with a custom liquid block i.e. {{ product.selected_variant.metafields.content.description }}

 

Though in most themes this info wont update when the variant is changed , so theyneed both liquid and javascript customizations.

 

If you need this customization built for you then contact me by my email for services, or DM me(slower).
Contact info in forum signature.
ALWAYS please provide context, examples: store url, theme name, post url(s) , or any further detail in ALL correspondence.

 

Good Luck.

 

 

Contact paull.newton+shopifyforum@gmail.com for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org


tim
Shopify Partner
4481 532 1634

It could be easier to split your product into 2 separate products and implement product variations as per https://support.maestrooo.com/article/307-product-creating-product-variations-that-link-to-different... 

As seen in demo store at https://impact-theme-sound.myshopify.com/products/mw07-plus-atomobili-lamborghini-polished-black-mat... 

 

Because these would be separate products you'd be able to configure their product page templates with different texts.

 

 

If my post is helpful, hit the thumb up button -- it will help others with similar problem to find a solution.
I can be reached via e-mail tairli@yahoo.com

EasifyApps
Shopify Partner
635 20 54

Hi @epoll24,

The Easify Product Options app offers a couple of solutions that might interest you 🤗:

  1. Utilize the app's Advanced conditional logic to display different descriptions based on the Shopify variants selected by customers. You can create the descriptions using the Paragraph option type. Here's a sample:

dwdw.png

gh.png

Simple settings:

EasifyApps_0-1714806544087.png

EasifyApps_1-1714806551539.png

EasifyApps_2-1714806559748.png

 

  1. Alternatively, you can split your existing products into 2 separate ones, each with its own description. Then, leverage the Option URL feature in the app to establish cross-product links between them. This way, on the product page, it appears as if customers are switching between regular Shopify variants, but in reality, they're transitioning between different products. Here's an example:

fef.png

EasifyApps_3-1714806983521.png

 

Let me know which approach you prefer, and I can guide you through the setup. Alternatively, reach out to the Easify team via the in-app live chat for assistance.

Easify Product Options: Any product options app can help you create custom options, but Easify turns those options into sales and conversions!
Easify Inventory Sync: Automate inventory syncing for Bundles, Duplicates, and Raw Materials. Say goodbye to manual tracking headaches.
Easify Product Attachments: Enrich your store with downloadable content. Easily add PDFs and other files to product or any page.
>>> Try Apps for Free | 24/7 Live Chat Support

soulchild37
Shopify Partner
230 9 74

Hi Epoll24,

 

You can utilize the metafield (Custom Data) feature, to store the description unique to each of the product variants.

You can go to your store Settings > Custom Data > Variants, and create a custom definition, with name "Variant Description" ,  Namespace and key "custom.variant_description", set the type to "Rich Text" .

After creating this definition, you can go to your product > select the variant, and scroll to metafield sections, and find the "Variant Description" , and you can enter the description you want for that variant.

 

soulchild37_0-1727200899022.png

 



After this, you can go to your store theme > Customize, and navigate to the product page template, and click "Add block" under the "Product information" section, and select "Custom Liquid". Next, you can click into this "Custom Liquid" block, and paste the code below : 

 

 

{% for variant in product.variants %}
<div class="yagi-variant-description" data-variant-id="{{ variant.id }}" style="display:none;">
  {{ variant.metafields.custom.variant_description | metafield_tag }}
</div>
{% endfor %}

<script>
function yagiHideAllVariantDescriptionExcept(variant){
  document.querySelectorAll('.yagi-variant-description').forEach(el => {
    el.style.display = 'none';
  });

  const descriptionEl = document.querySelector(`.yagi-variant-description[data-variant-id="${variant}"]`);
  if (descriptionEl){ descriptionEl.style.display = 'block'; }
}

const queryString = location.search;
const urlParams = new URLSearchParams(queryString);
var variantId = '{{ product.variants.first.id }}';

if(urlParams.get('variant')){
  variantId = urlParams.get('variant');
}

yagiHideAllVariantDescriptionExcept(variantId);

document.addEventListener("DOMContentLoaded", (event) => {
  document.querySelector("input[type='hidden'].product-variant-id").addEventListener('change', yagiVariantChanged);
});

function yagiVariantChanged() {
  if (document.querySelector('.product-variant-id')?.value !== variantId) {
    variantId = document.querySelector('.product-variant-id')?.value;

    if(!variantId) { variantId == '{{ product.variants.first.id }}' }
    yagiHideAllVariantDescriptionExcept(variantId);
  }
}
</script>

 

Click "Save", then go to your online store, and navigate to the product , you should see the description show / hide based on the variant you have selected.

 

soulchild37_1-1727200899020.gif

 



If you would like to follow a step-by-step guide with screenshots for this, you can follow this guide I wrote here : https://yagisoftware.com/articles/how-to-set-different-description-for-each-product-variant-in-shopi... 

Hope this can help! 

Regards,

Axel Kee

Spent too much support time dealing with order cancellation request from customer? Wouldn't it be good if customer can cancel order on their own without bugging your support? Try out Cancellable app! https://apps.shopify.com/cancellable . I also write articles about store customization that can improve your customer shopping experience here : Yagi Software Blog

soulchild37
Shopify Partner
230 9 74

Hello Epoll24,

 

You can utilize the metafield (Custom Data) feature in the Store Settings, to save the description unique to each product variants.

You can go to your store Settings > Custom Data > Variants, and create a custom definition, with name "Variant Description" ,  Namespace and key "custom.variant_description", set the type to "Rich Text" .

After creating this definition, you can go to your product > select the variant, and scroll to metafield sections, and find the "Variant Description" , and you can enter the description you want for that variant.


After this, you can go to your store theme > Customize, and navigate to the product page template, and click "Add block" under the "Product information" section, and select "Custom Liquid". Next, you can click into this "Custom Liquid" block, and paste the code below : 

 

 

{% for variant in product.variants %}
<div class="yagi-variant-description" data-variant-id="{{ variant.id }}" style="display:none;">
  {{ variant.metafields.custom.variant_description | metafield_tag }}
</div>
{% endfor %}

<script>
function yagiHideAllVariantDescriptionExcept(variant){
  document.querySelectorAll('.yagi-variant-description').forEach(el => {
    el.style.display = 'none';
  });

  const descriptionEl = document.querySelector(`.yagi-variant-description[data-variant-id="${variant}"]`);
  if (descriptionEl){ descriptionEl.style.display = 'block'; }
}

const queryString = location.search;
const urlParams = new URLSearchParams(queryString);
var variantId = '{{ product.variants.first.id }}';

if(urlParams.get('variant')){
  variantId = urlParams.get('variant');
}

yagiHideAllVariantDescriptionExcept(variantId);

document.addEventListener("DOMContentLoaded", (event) => {
  document.querySelector("input[type='hidden'].product-variant-id").addEventListener('change', yagiVariantChanged);
});

function yagiVariantChanged() {
  if (document.querySelector('.product-variant-id')?.value !== variantId) {
    variantId = document.querySelector('.product-variant-id')?.value;

    if(!variantId) { variantId == '{{ product.variants.first.id }}' }
    yagiHideAllVariantDescriptionExcept(variantId);
  }
}
</script>

 

Click "Save", then go to your online store, and navigate to the product , you should see the description show / hide based on the variant you have selected.

 

 



If you would like to follow a step-by-step guide with screenshots for this, you can follow this guide I wrote here : https://yagisoftware.com/articles/how-to-set-different-description-for-each-product-variant-in-shopi... 

Hope this can help! 

Regards,

Axel Kee

Spent too much support time dealing with order cancellation request from customer? Wouldn't it be good if customer can cancel order on their own without bugging your support? Try out Cancellable app! https://apps.shopify.com/cancellable . I also write articles about store customization that can improve your customer shopping experience here : Yagi Software Blog
jackholeeen
Visitor
1 0 0

 

Hi good day, i have a question. I want to add another description by using this variation. yagi-variant-key_products  variant.metafields.custom.variant_key-products
How to do it by using this code. thank you so much

{% for variant in product.variants %} <div class="yagi-variant-description" data-variant-id="{{ variant.id }}" style="display:none;"> {{ variant.metafields.custom.variant_description | metafield_tag }} </div> {% endfor %} <script> function yagiHideAllVariantDescriptionExcept(variant){ document.querySelectorAll('.yagi-variant-description').forEach(el => { el.style.display = 'none'; }); const descriptionEl = document.querySelector(`.yagi-variant-description[data-variant-id="${variant}"]`); if (descriptionEl){ descriptionEl.style.display = 'block'; } } const queryString = location.search; const urlParams = new URLSearchParams(queryString); var variantId = '{{ product.variants.first.id }}'; if(urlParams.get('variant')){ variantId = urlParams.get('variant'); } yagiHideAllVariantDescriptionExcept(variantId); document.addEventListener("DOMContentLoaded", (event) => { document.querySelector("input[type='hidden'].product-variant-id").addEventListener('change', yagiVariantChanged); }); function yagiVariantChanged() { if (document.querySelector('.product-variant-id')?.value !== variantId) { variantId = document.querySelector('.product-variant-id')?.value; if(!variantId) { variantId == '{{ product.variants.first.id }}' } yagiHideAllVariantDescriptionExcept(variantId); } } </script>