Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Add custom badge to WooCommerce featured product.
- */
- function wpsimpel_add_featured_product_badge() {
- global $product;
- if ( $product->is_featured() ) {
- echo '<span class="product-badge custom-badge">' . esc_html_e( 'Featured product', 'your-text-domain' ) . '</span>';
- }
- }
- add_action( 'woocommerce_before_shop_loop_item_title', 'wpsimpel_add_featured_product_badge' );
- add_action( 'woocommerce_before_single_product_summary', 'wpsimpel_add_featured_product_badge' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement