I’m building a webshop with WordPress and Woocommerce. On the productoverview (archive) of a productcategories I want to show a label if the product has the category ‘New’. The following code works on the product-single, but it won’t show on the productcategory-page if I add the action in content-product.php.
I used the following code to show a label on the single product page and it works as it should.
function resign_article_is_new(){
if ( is_product() && has_term( 'Nieuw', 'product_cat' ) ) {
echo '<p class="new-lable">New</p>';
}
}
add_action( 'resign_new_article', 'resign_article_is_new');
When I want to show the label on the productcategory overview I used this, but the label wouldn’t appear.
do_action('resign_new_article');
Hope you can tell me what I’m doing wrong