Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you pass values through the url in Shopify?

Tags:

shopify

liquid

Juan

Hello I was hoping a Shopify expert could advise me.

I already have a collections template in use and I need to prepare this layout to work within Shopify as something supplementary to the whole ecommerce function.

http://www.psd2htmlservice.com/streetstyles.jpg

As you can see you would click on the thumbnails and a larger corresponding image appears on the left along with some text at the top.

As I say there's no ecommerce element attached to this part of the site but I was thinking each image could be a product added to a collection. I'm well versed on looping through product images and collections but I'm not sure how to achieve the functionality required keeping in mind (as I understand it) you can't pass a value through the url in liquid. All I can think of would be to use a new page that uses a template with some liquid code hardcoded in each time....but surely there would be a more streamlined way.

I would appreciate any help.

Many thanks

like image 827
Juan Chandler Avatar asked Oct 16 '12 19:10

Juan Chandler


People also ask

How do you pass a value in a URL?

Any word after the question mark (?) in a URL is considered to be a parameter which can hold values. The value for the corresponding parameter is given after the symbol "equals" (=). Multiple parameters can be passed through the URL by separating them with multiple "&".

How do I use URL in Shopify?

When entering your store URL, please note that the “. myshopify.com” and “https://” portion of your store URL are already pre-filled. For example, if your Shopify store URL is https://example-store.myshopify.com, you only need to enter “example-store” on the form.

What is the maximum passing value to a URL?

This URL must begin with the protocol (e.g. “http”) and end with a trailing slash if required by the web server. This value must not exceed 2,048 characters.


1 Answers

No, unfortunately you can not (as of June 2014)

There is a feature request called Expose current URL in Liquid for this but it has not yet been implemented.

Also, there are several older pages where this is asked on the Shopify help forms, probably the most direct is Pass variables to liquid template via URL which mentions:

You can't do this:

{{ request.myvar }}

to read myVal.

The common suggestions on the forums include:

  1. Using Javascript to read the URL and use it to modify the page or interact with the user,
  2. Create an application proxy which would be a page on your own server that it served up via a special link on your Shopify site (but it still does not actually allow you to access query variables in Liquid)
like image 81
cwd Avatar answered Sep 22 '22 11:09

cwd