Change the out of stock text on single products in WooCommerce on the Astra theme

Change the out of stock text on single products in WooCommerce on the Astra theme on child sites.

Snippet Type

Execute on Child Sites

Snippet

add_filter( 'woocommerce_get_availability', 'change_out_of_stock_text_woocommerce', 1, 2 );
function change_out_of_stock_text_woocommerce( $availability, $product_to_check ) {
// Change Out of Stock Text
if ( ! $product_to_check->is_in_stock() ) {
    $availability['availability'] = __('SOLD', 'woocommerce');
}
return $availability;
}

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.