How to extract URL from <a href=""> in Liquid

crusco
Tourist
5 0 1

I'm trying to use {{ product_type | url_for_type }} inside a <option value=""> but it returns a link <a href=""> tag.

is there a way to extract the URL from the href="" and return it inside the <option value=""> ?!

I've tried with strip_html but it doesn't work

{{ product_type | url_for_type }}
// Returns: <a href="/collections/all/video+night" title="video">video</a>

{{ product_type | url_for_type | strip_html }}
// Returns: "video" not what's inside href=""

 

0 Likes
g33kgirl
Shopify Partner
269 73 85

Hi @crusco, have you tried using:

{{ product.url}}
If you found my answer helpful, please LIKE and ACCEPT.
buymeacoffee.com/g33kgirl ☕
If you're not comfortable with code, please modify code files at your own risk.
Do NOT give out your passwords unless absolutely necessary.
0 Likes
LitExtension
Shopify Partner
898 101 159

Hi @crusco

Can you please share your store URL and take a screenshot of error? So I will check and provide a solution here. 

Greetings! 

LitExtension - Shopping Cart Migration Expert
If our answer is helpful then please accept as solution!
Are you looking for a solution to migrate to Shopify? Contact us for further assistance.
Try our FREE DEMO now!
0 Likes