wc_price

ACTION woocommerce\includes\wc-formatting-functions.php (ligne 566) github
Format the price with a currency symbol.
traduction française
Formatez le prix avec un symbole de devise.

Paramètres

Entrée :
$price, $args = array(
Sortie :
@param  float $price Raw price.
@param  array $args  Arguments to format a price {
@return string

Utilisation

Formater un prix avec la devise

Convertir un nombre en prix formaté selon les paramètres de la boutique

pricing technical
// Formater un prix avec la devise configurée
$prix_brut = 49.99;
$prix_formate = wc_price($prix_brut);

echo 'Prix: ' . $prix_formate; // Affiche: Prix: 49,99 €

// Avec des arguments personnalisés
echo wc_price(150, array(
    'currency' => 'USD',
    'decimals' => 2
));

Actualités

Chargement des actualités...