Shoptimizer includes an “Out of stock” label over products that have their stock status to be out of stock. This is how it looks on the theme demo.
![Out of stock](https://www.commercegurus.com/wp-content/uploads/2021/02/shoptimizer-outofstock.jpg)
You can change this “Out Of Stock” text with the following code snippet.
1 2 3 4 5 6 7 8 |
/** * Change "Out Of Stock" text. * */ function mydomain_change_out_stock_string() { return __( 'No stock', 'shoptimizer' ); } add_filter( 'shoptimizer_shop_out_of_stock_string', 'mydomain_change_out_stock_string' ); |
You can either:
- Paste the code into the child theme’s functions.php file.
- Or add it via the Code Snippets plugin.
If you’d like to remove it entirely, you can use this function instead.
1 2 3 4 |
add_action( 'after_setup_theme', 'cg_remove_outofstock', 99 ); function cg_remove_outofstock() { remove_action( 'woocommerce_before_shop_loop_item_title', 'shoptimizer_shop_out_of_stock', 8 ); } |