Is there way to change a title for a different variation on shopify?

Is there way to change a title for a different variation on shopify?

Fightingfatigue
Tourist
11 0 0

Hi I would like when I click on the different variations then the title should be different - Is this possible? 

 

This would also be good for google ads! 

 

Thank you very much

Any advice is appreciated.

Replies 2 (2)

Small_Task_Help
Shopify Partner
489 15 34

Hi,

 

Adding JavaScript Functionality can help

 

Code example

 

<script>
document.addEventListener('DOMContentLoaded', function() {
  var variantSelector = document.querySelector('#product-selectors');
  var titleElement = document.querySelector('.product-title');

  variantSelector.addEventListener('change', function() {
    var selectedVariant = variantSelector.value;
    var variantTitle = document.querySelector(`option[value="${selectedVariant}"]`).text;
    titleElement.textContent = variantTitle;
  });
});
</script>

 

If you need more help on this you can contact us

Click here to Contact and Get Shopify Store Help
We are Shopify Experts   from Ecommerce Small Task Company.

Dan-From-Ryviu
Shopify Partner
8382 1650 1661

Hi @Fightingfatigue 

What theme are you using? Could you share your store URL so we can check? 

- Helpful? Like and Accept solution to let me know or Buy me Coffee ❤️!
- Ryviu - Product Reviews app, collect product reviews, import reviews from AliExpress, Amazon, Etsy, Shopee and Walmart and CSV.
- Lookfy app: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Enjoy 1 month of Shopify for $1. Sign up now.