The liquid to add the product variant title into a Shopify Notification Email

Solved
Tourist
13 0 2

Hi, I was wondering if I could get some help with liquid in the Shopify email notifications. I sell jewelry, including rings of different sizes. I want to be able to include the variant title in the title of the product. For example, currently, in the order confirmation email, if someone purchases a Megan Freshwater Pearl Ring with a ring size of 8, in the confirmation email it reads 'Megan Freshwater Pearl Ring - 8' I would instead like the liquid code that would make it read 'Megan Freshwater Pearl Ring - Ring Size 8'. Ring Size is the variant title, so just inserting that in the order confirmation code

0 Likes
Highlighted
Shopify Partner
48 4 10

Hi ConnorHolliday!

 

This shouldn't be too hard to fix, it's just a bit hard without me seeing your exact email template code.

Generally you would be able to add something in like this:

{{ line.variant.title }}

but depending on the specifics of your code it may or may not work. You will still probably need to update the code a bit extra though so that the old ' - 8' part is removed.

 

If you're able to show me the part of the code you'd like to update, I'd be happy to help out. Otherwise I'd be happy to request access to your store and make the update for you if you like.

 

Please let me know how you go :)

Josh

 

Joshua Sarros - Freelance Web Developer from Melbourne, Australia
joshuasarros@gmail.com
0 Likes
Highlighted
Tourist
13 0 2

Hey Joshua, thanks for the reply. The relevant code is as follows: 

<h3 style='color:#000;display:block;font-family:"Lucida Sans", Lucida;font-size:24px;font-style:normal;font-weight:bold;line-height:1.1;letter-spacing:0;margin:0;margin-bottom:12px;text-align:left'>{{ line.title }} {{ line.variant.title }} </h3> <p style="margin:0;padding-bottom:0">Quantity: {{ line.quantity }}<br /> Total: {{ line.price|money }}

I've bolded in the above the code you recommended I add. line variant code add.png

0 Likes
Highlighted
Tourist
13 0 2

The above screenshot is what has happened. The product title changed from

 

''"Be the Light" Black Onyx and Diamond Sterling Silver Ring - 9'

to 

'"Be the Light" Black Onyx and Diamond Sterling Silver Ring - 9 9'

 

So changing from {{ line.title }} to {{ line.title }} {{ line.variant.title }} added a ' 9' after the product title. Besides the fact that adding {{ line.variant.title }} did not end us up with "Be the Light" Black Onyx and Diamond Sterling Silver Ring - Size 9', which is what is desired, what worries me is that it looks like a product's variant is incorporated into {{ line.title }}, which I think makes my issue a bit more complicated. Any suggestions?

0 Likes
Highlighted
Shopify Partner
48 4 10

Thanks for that!

I was just about to explain to you how to make the 'Ring Size' text to be included, but I realised that it wouldn't work since you may sell other items that aren't rings. Is that right? You wouldn't want it to always show 'Ring Size' would you?

Joshua Sarros - Freelance Web Developer from Melbourne, Australia
joshuasarros@gmail.com
0 Likes
Highlighted
Tourist
13 0 2
Yea, that's correct Josh.
0 Likes
Highlighted
Tourist
13 0 2

Yup, that is correct. Also makes it a bit more complicated.

0 Likes
Highlighted
Shopify Partner
48 4 10

haha it sure does, but no problem! 

It's a bit hard because I can't go through your products and variants to get these answers, but if you're happy to help out I should be able to get a soultion for you!

 

Do you have anything distinct between your ring products (that we need to apply this text to) and other products? What I am thinking is you might have a collection that all ring products are added to, or perhaps you have added a unique tag only to the ring products? Anything like that that we could use to determine if the item is a ring?

Joshua Sarros - Freelance Web Developer from Melbourne, Australia
joshuasarros@gmail.com
0 Likes
Highlighted
Tourist
13 0 2

Hey Josh, awesome thanks. Yeah, let's figure this out. I appreciate the help. All ring products have a product tag equal to 'Rings'. There is a collection called 'Rings' of products with that product tag. 

0 Likes
Highlighted
Shopify Partner
48 4 10

Thanks for that! Using the 'Rings' tag should be a good option to go with.

 

What you should be able to do now is take out this part:

{{ line.title }} {{ line.variant.title }}

Replacing it with this:

{% if line.product.tags.contains 'Rings' %}{{ line.product.title }} - Ring Size {{ line.variant.title }}{% else %}{{ line.title }}{% endif %}

Essentially this code just checks whether the product has the 'Rings' tag, if it does then it will output the title which includes 'Ring Size', otherwise it will default back to how it used to display.

 

Hopefully this will work for you! Let me know how you go with it?

Joshua Sarros - Freelance Web Developer from Melbourne, Australia
joshuasarros@gmail.com
0 Likes