Home Contact Us Payments SC Commerce SC Commerce Docs SC Commerce Snippets

Simply Computing

We make websites. Simple.

Replace ‘out of stock’ message by ‘sold’

Replace the message that shows when an item is out of stock to instead mark the product as sold.

 * Replace out of stock message by sold

add_filter('woocommerce_get_availability', 'sc_woo_change_availability_to_sold');

function sc_woo_change_availability_to_sold($availability) {

  $availability['availability'] = str_ireplace('Out of stock', 'Sold', $availability['availability']);
  return $availability;

   View Raw Code ID: 91108