Last active
September 19, 2019 10:29
-
-
Save xadapter/c16bd38ec7aa11c59b6cd176218b38e2 to your computer and use it in GitHub Desktop.
Snippet to hide text from WooCommerce stock availability on product page. PluginHive WooCommerce Shipping Plugins used - https://www.pluginhive.com/product/multiple-carrier-shipping-plugin-woocommerce/, https://www.pluginhive.com/product/woocommerce-ups-shipping-plugin-with-print-label/, https://www.pluginhive.com/product/woocommerce-fedex-shipp…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Snippet to hide text from Woocommerce stock availability on product page. | |
* Created at : 23 July 2018 | |
* Updated at : 23 July 2018 | |
* PluginHive Plugins : https://www.pluginhive.com/plugins/ | |
* Gist Link : https://gist.github.com/xadapter/c16bd38ec7aa11c59b6cd176218b38e2 | |
*/ | |
add_filter( 'woocommerce_get_availability', function( $stock_arr ){ | |
$text_to_hide = array( "in stock" ); // Text to hide | |
if( ! empty($stock_arr['availability']) ) { | |
$stock_arr['availability'] = str_replace( $text_to_hide, "", $stock_arr['availability'] ); | |
} | |
return $stock_arr; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment