gabriele
4/1/2020 - 5:15 PM

Disponibile ed Esaurito - Modifica Testo


// ---- Etichetta DISPONIBILE ed ESAURITO su prodotti
function etichette_availability( $availability, $product ){
    // Change "in stock" text
    $new_availability_text = 'Disponibile' . str_replace("in stock", $availability['availability']);
    $availability['availability'] = $new_availability_text;

   // Change "out of stock" text
    if( $availability['class'] == 'out-of-stock' ){
      $availability['availability'] = 'Esaurito';
    }
    return $availability;
}
add_filter( 'woocommerce_get_availability', 'etichette_availability', 10, 2 );