Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Add custom badge to WooCommerce products in a specific category.
- */
- function wpsimpel_add_category_product_badge() {
- if( has_term( 'posters', 'product_cat' ) {
- echo '<span class="product-badge custom-badge">' . esc_html_e( 'New arrival', 'your-text-domain' ) . '</span>';
- }
- }
- add_action( 'woocommerce_before_shop_loop_item_title', 'wpsimpel_add_category_product_badge' );
- add_action( 'woocommerce_before_single_product_summary', 'wpsimpel_add_category_product_badge' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement