Change where button links to (what URL it points to) based on user account tags.

Highlighted
New Member
2 0 0

Hi there.

 

Here is what I am trying to accomplish:

 

- (for context) User fills out a form

- User clicks the 'proceed' button

- If user has Tag X associated with their customer account, the button takes them to URL 1

- If user does NOT have Tag X associated with their customer account, the button takes them to URL 2.

 

2 URLs total, all depending on 1 specific customer tag.  Assume that all customers at this point will be logged into the store so will be able to determine if they have the tag on their account or not. 

 

Is this possible?  Thank you!

0 Likes
Highlighted
Shopify Partner
1445 195 523

You can use an if statement in liquid to check the customer tags and change a destination in the onclick of the submit button:

 

        <form target="_blank">
          <input type="hidden" name="fullname" value="Ninthony" />
          <input onclick="window.location.href = {% if customer.tags contains 'some-tag' %}'https://www.websitefortag.com'{% else %}'https://www.websitenotfortag.com'{% endif %};" type="submit" value="Proceed" />
        </form>
If my solution helped you, please like and accept as solution!
If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish :D
Highlighted
New Member
2 0 0

Thanks, exactly what I was looking for. I'll try this.

0 Likes