PHP snippet for free version of Astra theme.
Make sure that you are using the child theme of Astra theme. Now open the functions.php file of your child theme and drop the following PHP snippets at end of the file.
1 2 3 4 5 6 7 8 9 10 11 12 |
/** * Displaying the stock status below the product title * * @copyright 2019 PaulChinmoy.com * @author Paul Chinmoy */ add_filter( 'woocommerce_get_stock_html', '__return_null', 99, 2 ); add_action( 'woocommerce_single_product_summary', 'paulc_add_stock_html', 6 ); function paulc_add_stock_html() { global $product; echo astra_woo_product_in_stock( '', $product ); } |
PHP snippet for PRO version of Astra theme.
Make sure that you are using the child theme of Astra Pro theme. Now open the functions.php file of your child theme and drop the following PHP snippets at end of the file.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
/** * Displaying the stock status below the product title * * @copyright 2019 PaulChinmoy.com * @author Paul Chinmoy */ add_action( 'astra_woo_single_title_after', 'paulc_add_stock_html', 9 ); function paulc_add_stock_html() { global $product; add_filter( 'woocommerce_get_stock_html', '__return_null', 99, 2 ); echo astra_woo_product_in_stock('', $product ); } |
Mary Ritzel says
Thank you SOOOO much. Searching everywhere for this problem. You’re awesome 🙂
Dénes Szilárd says
Hi, thanks for the post, is useful. Though, my question is, what is the correct way of removing it totally?
I would like to remove the text and the “in stock” product number also.
Thanks,
Szilard
Paul says
You will just use this single line of code
Brenda Malone says
Very, very cool. Thank you.