Passing product line item properties to cart via permalink

Caroline_Elisa
Tourist
12 0 1

Is this possible? I know I can pass notes and cart attributes but is there a way to pass line items?

http://docs.shopify.com/manual/configuration/store-customization/page-specific/cart-page/cart-permal...

/cart/70881412:1,70881382:1?attributes[where-from]=came-from-newsletter-2013-02-14&attributes[some-other-key]=some-value
 

Thanks!

0 Likes
Caroline_Schnap
Shopify Staff
Shopify Staff
5710 1 350

You cannot.

However, you can add to the cart and then submit Line Item Properties, and redirect to the checkout.

If you don't want to use a form, you can use a link with JavaScript:

<a href="http://your.shopify.url/cart/add"; onclick="var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href; var v = document.createElement('input'); v.setAttribute('type', 'hidden'); v.setAttribute('name', 'id'); v.setAttribute('value', 'VARIANT-ID'); f.appendChild(v); var r = document.createElement('input'); r.setAttribute('type', 'hidden'); r.setAttribute('name', 'return_to'); r.setAttribute('value', '/checkout'); f.appendChild(r); var lip = document.createElement('input'); lip.setAttribute('type', 'hidden'); lip.setAttribute('name', 'properties[LABEL]'); lip.setAttribute('value', 'YOUR VALUE'); f.appendChild(lip); f.submit(); return false;">BUY NOW</a>

Here's an example of this in action:

http://the-new-standard-theme.myshopify.com/pages/buy-a-mug-externally-with-engraving

But you can't paste a link like that in a newsletter form. You can't use JavaScript in an email.

So, no.

0 Likes
Caroline_Elisa
Tourist
12 0 1

Thanks so much Caroline!

But yes, I was trying to create a link that could be emailed so we could build orders for customers.

0 Likes
Jason
Shopify Expert
10360 158 2004

But yes, I was trying to create a link that could be emailed so we could build orders for customers.

You could still do something like that. Rather than a permalink in the email, link to a product with some query-strings appended to the url. When someone clicks the link in the email the landing page detects that extra info in the location.search and sets all the product options (just like Caro's code above), adds it to cart, then redirects to checkout. Not an elegant approach but it could be coded up to to gracefully handle out of stock situations better than a permalink.

I jump on these forums to help and share some insights. Not looking to be hired, and not looking for work.

Don't hand out staff invites or give admin password to forum members unless absolutely needed. In most cases the help you need can be handled without that.


★ http://freakdesign.com.au ★
0 Likes
zzzzzz
New Member
1 0 0

@Jason Is this still the only way to do this, or is there now an official way to do it?

0 Likes