Custom Add to Cart button works in theme editor, but not in preview

Solved
Tourist
4 1 0

I have the following code that works when adding a product to a cart in theme editor, but not when I test it out in preview.  Any thoughts?

 

<form method="post" action="/cart" >
<input type="number" name="updates[30115548528691]" onfocus="this.select()" value="1">
<input value="ORDER NOW" type="submit" />

</form>

0 Likes
Highlighted

Success.

Tourist
4 1 0

I was able to get it working.  The cart URL has different structures for both theme editor and preview. To get my code working, I had to explicitly define the cart path for the preview URL within the form action.  

 

<form method="post" action="//xyz.myshopify.com/cart" ...>

0 Likes