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
Excursionist
15 0 5

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
830 28 75

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

To Get Shopify Experts Help, E-mail - hi@ecommercesmalltask.com
About Us - We are Shopify Expert Agency
At Google My Business - Ecommerce Small Task - Hire Shopify Developers Ahmedabad

Dan-From-Ryviu
Shopify Partner
10887 2145 2282

Hi @Fightingfatigue 

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

- Solved it? Hit Like and Accept solution! ❤️Buy Me Coffee❤️
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Ryviu - Reviews & QA app: Collect product reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.