My client wants to have a sale_flash ‘top product’ shown at products that have the category ‘top products’ checked.
I have managed to get this code working in woocommerce/templates/loop/sale-flash.php:
global $post, $product;
<?php if (is_product_category(‘top category’)) : ?>
<?php echo apply_filters(‘woocommerce_sale_flash’, ‘<span class=”onsale”>’.__(‘Top product!’, ‘woocommerce’).'</span>’, $post, $product); ?>
<?php endif; ?>
With this code all the products listed in category ‘top category’ have the sale-flash balloon in the right top. That’s oke, but the sale-flash balloon has to be shown also on those ‘top category’-checked products in other category lists. And that’s not happening right now.
‘if (product_cat(‘top category’))’ Doesn’t work off course
Does anybody know how to manage this?
It’s a must-have for the client.
- The topic ‘Sale_flash when product has category 'examplename'’ is closed to new replies.