Замена статуса товара “Out of Stock” на “Sold”
Задача: На странице товара (single-product.php) необходимо изменить название статуса “Out of Stock” на “Sold”.
// Change "Out of Stock" to "Sold" text
add_filter( 'woocommerce_get_availability', 'wc_custom_get_availability', 1, 2);
function wc_custom_get_availability( $availability, $_product ) {
if ( ! $_product->is_in_stock() ) {
$availability['availability'] = __('Sold', 'woocommerce');
}
return $availability;
}
Leave a Reply
You must be logged in to post a comment.