Skip to content

Instantly share code, notes, and snippets.

@ibndawood
Created April 8, 2019 13:55
Show Gist options
  • Save ibndawood/ea3f6a86e5d457bc79974788dccf08ec to your computer and use it in GitHub Desktop.
Save ibndawood/ea3f6a86e5d457bc79974788dccf08ec to your computer and use it in GitHub Desktop.
WooCommerce - Change "Out of Stock" text to "Sold Out"
add_filter( 'woocommerce_get_availability_text', 'wc_change_out_of_stock_text', 10, 2 );
function wc_change_out_of_stock_text( $availability, $product ) {
if ( ! $product->is_in_stock() ) {
$availability = esc_html__( 'Sold Out', 'woocommerce' );
}
return $availability;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment