Debut: Sometimes cart popups, sometimes goes to cart page, how to display low stock

Highlighted
New Member
1 0 0

Hello,

This is my first time posting. I have been searching, but can't find any answers. This is for the theme debut. 

I was testing out my website. It works but there are a few annoying issues.

I only have 5 items. 

So 4 of my products will go to the cart page after "add to cart." While one of the items will remain on the page and just have a cart popup. I want all my items to stay on the page but just show the popup. 

I don't know why there's this inconsistency, maybe it's because I added the infinity options app to my products except that one item?

I didn't add any code except the subscription box. 

I tried doing https://community.shopify.com/c/Shopify-Design/Product-pages-Stay-on-the-product-page-after-adding-p... but it only worked for 1 of the 4. I ended up removing the codes because it stopped showing the numbers on the cart icon and it didn't show the cart popup. 

Also I would like to show the low quantity (under 5) on the product page. I tried like 3-4 different ones. I found this code which works in displaying the quantity. But how do I adjust it so it only shows when the quantity is less than 5? 

  <p>
{% assign total=0 %}
      	{%for variant in product.variants %} {% capture i %}{{ total | plus:variant.inventory_quantity }}{%endcapture%}
      	{% assign total = i %}
      	{%endfor%}
      	<b>Total Qty Avalaible : </b>{{ total }}
      </p>

 Sorry about the formatting, I just pasted it from the form. 

Thank-you!

0 Likes