woocommerce_get_price_html

FILTER woocommerce\includes\abstracts\abstract-wc-product.php (ligne 1952) github
Returns the price in html format.
traduction française
Renvoie le prix au format html.

Paramètres

Entrée :
$price, $this
Sortie :
@param string $deprecated Deprecated param.
@return string

Utilisation

Personnaliser l'affichage du prix HTML

Modifier complètement comment le prix est affiché

products pricing ui
// Personnaliser l'affichage du prix
add_filter('woocommerce_get_price_html', 'affichage_prix_personnalise', 10, 2);

function affichage_prix_personnalise($price, $product) {
    // Ajouter "À partir de" pour les produits variables
    if ($product->is_type('variable')) {
        $price = 'À partir de ' . $price;
    }
    
    // Ajouter une indication de TVA
    if ($product->is_taxable()) {
        $price .= ' TTC';
    }
    
    return $price;
}

Actualités

Chargement des actualités...