Jump to content

Checking if the product (also variants in color and size) is in cart?


bloggus

Recommended Posts

With the code below it is possible to check in tpl-file, if the products is already in cart, BUT this code do not take into the account variants of the products, like size or color.

        {if $product.quantity <= 0}
            {$in_cart = 0}
            {foreach from=$cart['products'] item='cart_product' }
            {if $cart_product['id_product'] == $product.id}
                {$in_cart = 1}
                {break}    
            {/if}
            {/foreach}
        {/if} 

 

Is is possible to alter the code so it also check if the size and color is in the cart? Not only check the product id?

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...