Created
July 6, 2024 17:43
-
-
Save shameemreza/2e6442ef5062ed27c49a3e0ea6c73f30 to your computer and use it in GitHub Desktop.
Show out of stock label in catalogue when product is on backorder in Woocommerce.
This file contains hidden or 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_action( 'woocommerce_before_shop_loop_item_title', 'show_product_loop_backorder_badge', 5 ); | |
function show_product_loop_backorder_badge(){ | |
global $product; | |
if ( $product->is_on_backorder() ) { | |
printf('<span class="on-backorder">%s</span>', esc_html__('Out of stock', 'woocommerce')); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment