Voorraad op archive pagina in WooCommerce
Wil je direct op de shop overzichtspagina tonen of een product op voorraad is of juist niet? Met deze snippet in je functions.php of in de plugin Code Snippets voer je dit door.
/*** Voorraad status ***/
function stock_catalog() {
global $product;
if ( $product->is_in_stock() ) {
echo ‘
‘ . __( ‘ op voorraad’, ‘envy’ ) . ‘
‘;
} else {
echo ‘
‘ . __( ‘ Niet op voorraad’, ‘envy’ ) . ‘
‘;
}
}
add_action( ‘woocommerce_after_shop_loop_item’, ‘stock_catalog’, 1000 );