1

Running on my localhost, I can't get Store 2 to add products to the cart.

  • I've completely removed my .htaccess file and set my index page to index.php to eliminate rewrites as a potential cause.
  • You do not need to be logged-in to purchase (via settings)
  • SSL is not required for checkout actions (via settings)
  • Running EE 2.7.2 and Store 2.0.6

My template code looks like:

{exp:store:product entry_id="{entry_id}" return="cart/index" disable_javascript="yes"}
    <button class="btn">Add to Cart</button>
{/exp:store:product}

Which renders to:

<form method="post" class="store_product_form">
    <div style="margin:0;padding:0;display:inline;">
    <input type="hidden" name="return_url" value="cart/index">
    <input type="hidden" name="entry_id" value="2786">
    <input type="hidden" name="nosubmit" value="1">
    <input type="hidden" name="ACT" value="41">
    <input type="hidden" name="RET" value="book/[url_title_redacted]">
    <input type="hidden" name="site_id" value="1">
    <input type="hidden" name="_params" value="69KWfitkNRkGcCM70xb/xVBDRDgS8b+Gidj4Jm17QqWWwRtxKugeyL9rqZbeUJCEoAjGCVwAIpUaWG9crrWenIab/MHr9uS1p/7XVJNV9Ei5jfM0Crio4DhMjdb0GvizwuV4r5x2Qx3GlbWHpNJ9+RPXrGkZEamm/FaJJIaTBzM=">
    <input type="hidden" name="XID" value="785db0072762b9f7c3397ea0e4b95f9a5efbf092">
    </div>
    <button class="btn">Add to Cart</button>
</form>

After submission, I get to my /cart template, but only the contents of my {if no_items} conditional displays. Removing the {if no_items} conditional results in no output between the store:checkout tag pair at all.

Where to troubleshoot next?

4

Add a item_qty field to tell Store how many products to add to the cart.

<input name="item_qty" value="1">

Also, there is a debug tag that will help you see what's happening in your cart more clearly. Pop this into any of your templates:

{exp:store:checkout_debug}
| improve this answer | |
  • 1
    For the win! Gracias Anna. – Derek Hogue Nov 13 '13 at 17:00
  • 1
    If you only want the user to add a single of any product quantity you can also use <input type="hidden" name="item_qty" value="1" /> – Justin Long Nov 13 '13 at 22:31
0

I'm not sure this will help, but I have a the same setup to yours and I have found that product URLs that have a period do not add to cart while without do.

So for example "item_no.2" will not add, while "item_no2" will.

I'm currently trying to work out if it's related to buildwithstructure potentially.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.