Syndicate

Feed

Testing Cart Functionality

You wanna buy a bag to carry around your junk, and give me opportunity to buy more junk for myself?



Last edited by Caroline Schnapp about 5 weeks ago.

Comments

question

Thank you for this. This is a really cool trick and exactly what I have been looking for, cannot believe I have not noticed this before.

I am trying to make alternative store front with php/json and shopify rest api. And this definately gets me closer to where I want to be.

I got one questions. How come it does not go to cart page after form is submitted ? That is when I do that on my page and click submit the products are added to the cart and I am sent to the cart page, it does not happen in your case.

Using return_to=back

How come it does not go to cart page after form is submitted ?

Because of this:

<input type="hidden" value="back" name="return_to" />

more declarative option possible?

Hi Caroline, thanks for this.

Is there an option to make a call to shopify, passing a product permalink and sku (say), and it have it return the standard shopify html where you select a variant, and press the submit button? The entire form in other words, like this:

<form action="/cart/add" method="post">
 
  <div id="product-variants">
    <div id="price-field">£3.00 GBP
    </div>
 
    <div class="selector-wrapper">
      <select id="product-select-option-0" class="single-option-selector">
        <option value="1024x768">1024x768
        </option>
      </select>
    </div>
    <select style="display: none;" id="product-select" name="id">
 
      <option value="29928632">1024x768 - £3.00
      </option>
 
    </select>
 
  </div>
 
  <input class="" src="http://cdn.shopify.com/s/files/1/0031/8302/assets/purchase.png?1261150992" name="add" value="Purchase" id="purchase" type="image">
</form>

I'd prefer to do this - work with logical names like the permalink and the sku - than work with id's. It worries me from a maintenance point of view.

Thanks for your help Caroline.
Mike.

There's a way, yes.

It's worth creating a tutorial for this. Give me a week to put it together.

Hint: you will need to use {% layout none %} in a special template in your Shopify's admin, while using PHP (or Ruby) to include the HTML on your page on that website of yours that's not hosted on Shopify.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <css> <html> <javascript> <mysql> <php> <span> <a> <b> <i> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <sup> <sub> <dd> <del> <blockquote> <img> <q> <p> <div>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <css>, <html>, <javascript>, <mysql>, <php>, <rails>, <ruby>.

More information about formatting options

CAPTCHA
I have to wonder if you're a human spammer or a machine, or less likely someone who cares to leave his or her thoughts behind.