Last active
June 17, 2020 16:29
-
-
Save xlawok/079603e2a9ec67927055aa058d7a3504 to your computer and use it in GitHub Desktop.
woocommerce add custom badge on image (based on tag/category) of related products
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ADD NOWOŚĆ TAG ONA ZDJĘCIE PRODUKTÓW POWIĄZANYCH | |
add_action('woocommerce_before_shop_loop_item_title','show_novelty_on_related_products',11); | |
function show_novelty_on_related_products(){ | |
global $product; | |
if(is_product()){ | |
if( has_term( array( 'Nowości' ), 'product_tag' ,$product) ) { | |
echo '<span class="novelty">Nowość!</span>'; | |
} | |
} | |
else return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment