Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
Hello,
I Would like to pass values from a form to another page.
I tried by using a capture of {{ content_for_header }} with à GET form input but it only works once as all others inputs done afterwards are ignored.
I also tried with POST form unsuccessfully.
There's my code :
{%- capture contentForQuerystring -%}{{ content_for_header }}{%- endcapture -%}
{%- assign pageUrl = contentForQuerystring | split:'"pageurl":"' | last | split:'"' | first | split:'.myshopify.com' | last |
replace:'\/','/' |
replace:'%20',' ' |
replace:'\u0026','&'
-%}
{%- unless pageUrl contains "?" -%}{% break %}{%- endunless -%}
{%- assign pageQuerystring = pageUrl | split:'?' | last -%}
{%- assign tag = pageQuerystring | split:'=' | last -%}
{%- assign query_tags = tag | split: "," -%}
{% assign id_input = "1234" | concat: query_tags %}
Is there any way to do it using a GET or POST method ?
Thanks for your help !
Solved! Go to the solution
This is an accepted solution.
Using FormData you could retrieve the desired content and store it in sessionStorage and check for this on the next page.
This is an accepted solution.
Using FormData you could retrieve the desired content and store it in sessionStorage and check for this on the next page.