Add to Cart Redirect not adding items to cart on mobile

New Member
2 0 0

Hello,

 

I'm tinkering with a custom theme and I've added add to cart buttons on the collection pages. When I try to add an item to cart on mobile from the collection page, I advance to the cart and am told that there are no items in my cart. This does not happen on desktop. It also doesn't happen if I have <input type="hidden" name="return_to" value="back" /> in the code above the endifs. This bit of code redirects users to the page they clicked from, rather than cart.

 

Here's the code I'm using:

 

 {% if product.available and product.id != 4517792195 %}
    {% if product.available and product.id != 56230674435 %}
    {% if product.available and product.id != 6317934723 %}
<form method="post" action="/cart/add" >
<input type="hidden" name="id" value="{{ product.variants.first.id }}" />
<input type="submit" value="{{ 'products.product.add_to_cart' | t }}" class="btn2" />

  {% endif %} {% endif %} {% endif %}
  
  {% if product.available == false %}<p>
  <input type="submit" value="{{ 'products.product.sold_out' | t }}" id="add" class="btn2 add-to-cart disabled" disabled="disabled" style="opacity: 0.5;">
			{% endif %}
</form> 
0 Likes