Jump to content

Show on product page the quantity in the cart of a specific product


Recommended Posts

I'm trying to show on product page the quantity of a product that the customer already added to the cart.

For example if the customer added 5 quantity of the product, show below the add to cart button:
"You have 5 product-name into the cart"

I checked the available variables into the "product-add-to-cart.tpl" but I can't find one that allow me to do that.

Does anyone know how to do that?

Link to comment
Share on other sites

  • 2 weeks later...

Try using the object $cart to iterate all cart items. If your cart item id equals your product page product id, then show the cart_quantity.

 

I.E.

        {foreach $cart.products item=item}
              {if $item->id_product == $product.id}
                {$item->cart_quantity}
              {/if}
              {/foreach}

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...