SKU in <title> tag

Solved
cotty
Tourist
9 0 2

Hi, feeling defeated so giving this forum a try.

Can anyone point me in the right direction to pull in the SKU code for title tag, please? I've found how to do this on product pages etc, but can't find anywhere that references how to include within title tag for SEO purposes.

0 Likes
KieranR
Shopify Partner
295 24 87

This is an accepted solution.

How exactly do you want it to be output? What if no sku exists? What if some variants have it but others don't?

General approach will be  to find the title tag liquid usially in theme.liquid and then use some of this in it:

{%- assign current_variant = product.selected_or_first_available_variant -%} <span>{{ current_variant.sku }}</span>

Full time Shopify SEO guy, based in NZ. Sometimes freelance outside the 9-5.
cotty
Tourist
9 0 2

Thank you Kieran, worked a treat!

0 Likes