Created
August 13, 2015 00:26
-
-
Save chrdesigner/981fabb5b86acb30b119 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
<?php | |
/* | |
* Add Stock Quantity in Catalog Loop | |
*/ | |
function odin_stock_catalog() { | |
global $product; | |
if ( $product->is_in_stock() ) { | |
echo '<div class="stock" >' . $product->get_stock_quantity() . __( 'EM ESTOQUE', 'odin' ) . '</div>'; | |
} else { | |
echo '<div class="out-of-stock" >' . __('SEM ESTOQUE', 'odin' ) . '</div>'; | |
} | |
} | |
add_action( 'woocommerce_after_shop_loop_item_title', 'odin_stock_catalog' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment