How to Append a tag to a customer through a form

Shopify Partner
3 0 0

Hi,

When a user checks out on my store, I tag him (even if he doesn't create an account).

When a user creates an account, I also tag him using a hidden input.

<input type="hidden" name="customer[tags]" value="custom_tag"/>

The problem is, if a user buys from my shop, then creates an account, the second tag being added overwrites all the previous tags instead of being appended.

I tried using the following, but it is not working either (throwing an error).

<input type="hidden" name="customer[tags]" value="{% customer.tags %},custom_tag"/>

What can I do?

0 Likes
Shopify Expert
265 1 13

Hey Charles, your liquid synthax is off:

<input type="hidden" name="customer[tags]" value="{% customer.tags %},custom_tag"/>

{% customer.tags %} is not the way to do it. Either use {{ customer.tags }} or {% if customer.tags %}...{% endif %}.

 

Jarvis @ Kaleido
- Slow Shopify Store? Install our PageSpeed Magic app.
- Have more questions? Feel free to email me.
- My reply helped? Click Like to show me some love!

0 Likes
Shopify Partner
13 0 2

@Charles32  @Jared_Malan

 

Where are you adding the hidden input with contact[tags]??  On the cart-template.liquid page in the form?   I have placed these tags in the newletter signup form, but was wondering if placing this input on the cart-template.liquid page will carry the input over to checkout and properly tag the customer?

 

Thanks!

0 Likes
Tourist
5 0 1

Hi,

I tried this in the customer.register.liquid file. However, only the customer tag is taken. All the previous tags are deleted. 

 

 <input type="hidden" id="customer_tags" name="customer[tags]" value="{{ customer.tags }}, register"/>
0 Likes
Shopify Expert
4 0 0
 <input type="hidden" id="customer_tags" name="contact[tags]" value="prelaunch_signup"/>

The above should work - note it's contact[tags]and not customer[tags]

0 Likes