I have set the following to childs functions file to show the sku and the availability in the archive page
/** Show SKU in product loop below product thumbnail */
function custom_after_title() {
global $product;
if ( $product->get_sku() ) {
echo '<div class="sku-archive">Smart Code:'.$product->get_sku().'</div>';
}
else
echo '<div class="sku-archive">Smart Code: N/A</div>';}
add_action( 'woocommerce_after_shop_loop_item_title', 'custom_after_title',10 );
//* Add stock status to archive pages
function envy_stock_catalog() {
global $product;
if ( $product->is_in_stock() ) {
echo '<div class="stock" >' . $product->get_stock_quantity() . __( ' in stock', 'envy' ) . '</div>';
} else {
echo '<div class="out-of-stock" >' . __( 'out of stock', 'envy' ) . '</div>';
}
}
add_action( 'woocommerce_after_shop_loop_item_title', 'envy_stock_catalog',11 );
It works fine except the priority.
Upon the code i have inserted in functions it is supposed to show sku first and availability afterwards.
In the live website it is shown the opposite (first show the availability and afterwards the sku!!!