Skip to content

Instantly share code, notes, and snippets.

@xadapter
Last active September 19, 2019 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xadapter/c16bd38ec7aa11c59b6cd176218b38e2 to your computer and use it in GitHub Desktop.
Save xadapter/c16bd38ec7aa11c59b6cd176218b38e2 to your computer and use it in GitHub Desktop.
/**
* 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