Sale_flash when product has category 'examplename' (1 post)

  1. robinGr
    Posted 3 years ago #

    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.


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic