Skip to content

Instantly share code, notes, and snippets.

@hslaszlo
Created October 5, 2023 10:29
Show Gist options
  • Save hslaszlo/3aad1609311bcfbefb1308c784a6a7f4 to your computer and use it in GitHub Desktop.
Save hslaszlo/3aad1609311bcfbefb1308c784a6a7f4 to your computer and use it in GitHub Desktop.
Change Out of Stock Text in WooCommerce
<?php
add_filter('woocommerce_get_availability_text', 'themeprefix_change_soldout', 10, 2 );
/**
* Change Sold Out Text to Something Else
*/
function themeprefix_change_soldout ( $text, $product) {
if ( !$product->is_in_stock() ) {
$text = '<div class="">Sold out.</div>';
}
return $text;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment