JoJo! Posted April 13, 2021 Posted April 13, 2021 Hello, In order to put a condition on the "add to cart" button which will say: If the products of category 3 are in the cart, the "Add to cart" button will be unavailable on products from other categories. For that, I would like to retrieve the id of the product categories present in the cart I have something that looks like it but just for the products already in the basket: {$ in_cart = 0} {foreach from = $ cart ['products'] item = 'cart_product'} {if $ cart_product ['id_product'] == $ product.id} {$ in_cart = 1} {/ if} {/ foreach} {if $ in_cart} {l s = 'Already in cart' d = 'Shop.Theme.Actions'} {else} {l s = 'Add to cart' d = 'Shop.Theme.Actions'} {/ if} thank you so much Jonathan Share this post Link to post Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now