really trying to nail an issue I can’t quite complete. I’ve raised a query already but reckon I was likely unlcear so hopefully a little clearer here.
I have amended the mini-cart to display a different image for every item added to the cart. This is to simulate the adding of bottles to a ‘case’. See image to show in action, and here is the code which makes it work.
Start your code here
<?php
if(WC()->cart->get_cart_contents_count() == 0){
echo '<img src="http://example.com/wp-content/uploads/2017/…/empty-case.png" alt="icon" />';
} elseif (WC()->cart->get_cart_contents_count() == 1){
echo '<img src="http://example.com/…/uploads/2017/06/case-with-1-bottle.png" alt="icon" />';
elseif (WC()->cart->get_cart_contents_count() == 2){
echo '<img src="http://example.com/…/uploa…/2017/06/case-with-2-bottles.png" alt="icon" />';
This continues until about 60 bottles or so, and works fine. The problem is, it's based on cart total, and there are other items in the shop that I don't want to include within this. I only want this for the 'single bottles' category and not 't-shirts' for example. Ideally, I'd love to just add something to exclude the other categories but I'm unsure what needs to be done. Any ideas / suggestions? Thank you!