Created
January 19, 2018 09:28
-
-
Save jessbudd/32b2bc6450750643683b21baa8b89274 to your computer and use it in GitHub Desktop.
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 this code block to php file: | |
// Add Backorder text to woocommerce images that are backordered products | |
function ff_add_backorder_badge() { | |
global $product; | |
if($product->stock !== '' && $product->stock <= 0) { | |
echo '<span class="out-of-stock">Backorder</span>'; | |
} | |
} | |
add_action( 'woocommerce_before_shop_loop_item_title', 'ff_add_backorder_badge', 9 ); | |
Add this CSS: | |
/*woocommerce available on backorder badge*/ | |
.woocommerce .out-of-stock { | |
position: absolute; | |
top: 0; | |
right: 0; | |
margin: 0; | |
background-color: #bcb1b3; | |
color: #ffffff; | |
z-index: 10; | |
padding: 5px 10px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment