How To Remove the Out Of Stock Badge in Neve Shop?
By default, in Neve, the out-of-stock products are marked with a suggestive label:
If you want to disable this, follow these steps:
- 1
-
Copy this code snippet:
// Remove the 'out_of_stock_badge' action function ti_remove_out_of_stock_badge() { if ( ! class_exists( 'WooCommerce' ) ) { return; // Early return if WooCommerce class does not exist } $functions = $GLOBALS['wp_filter']['woocommerce_before_shop_loop_item_title']; if ( ! is_object( $functions ) ) { return; // Early return if $functions is not an object } foreach ( $functions as $priority => $callbacks ) { if ( ! is_array( $callbacks ) ) { continue; // Skip the current iteration if $callbacks is not an array } foreach ( $callbacks as $key => $callback ) { // Check if the callback is an array and if the function matches 'out_of_stock_badge' if ( isset( $callback['function'] ) && is_array( $callback['function'] ) && isset( $callback['function'][1] ) && $callback['function'][1] === 'out_of_stock_badge' ) { remove_action( 'woocommerce_before_shop_loop_item_title', $callback['function'], $priority ); } } } } add_action( 'init', 'ti_remove_out_of_stock_badge' );
- 2
-
Paste it into the functions.php file of your child theme.
💡Result
📝 Note: If you need to find out more about the child theme, please refer to this doc.