Created
February 15, 2019 19:49
-
-
Save enamhasan/b8d205856f29e3b6b23ea458d4f86d80 to your computer and use it in GitHub Desktop.
Get the querystring values with liquid in shopify
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{%- capture contentForQuerystring -%}{{ content_for_header }}{%- endcapture -%} | |
{% comment %} Use string splitting to pull the value from content_for_header and apply some string clean up {% endcomment %} | |
{%- assign pageUrl = contentForQuerystring | split:'"pageurl":"' | last | split:'"' | first | split:'.myshopify.com' | last | | |
replace:'\/','/' | | |
replace:'%20',' ' | | |
replace:'\u0026','&' | |
-%} | |
{%- assign pageQuerystring = pageUrl | split:'?' | last -%} | |
{%- if pageQuerystring contains "18460587851873" -%} | |
{% include 'cart-add-on' %} | |
{%- endif -%} |
This is an old conversation, but i have a question @Christopher-Hayes ! The view parameter ofcourse breaks the layout, because it is looking for a non-existing view on a template? How did you deal with this problem?
Actually, I fixed this now. I just used a parameter "type" instead of "view"!
👍 Good to know.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is an old conversation, but i have a question @Christopher-Hayes !
The view parameter ofcourse breaks the layout, because it is looking for a non-existing view on a template? How did you deal with this problem?