FOX - Currency Switcher for WooCommerce

woocs_raw_woocommerce_price

Utilisez ce hook pour manipuler les valeurs de prix, par exemple arrondir le prix selon votre propre logique. Exemples :
  • /how-to-round-price-to-50-cents/ - arrondir le prix au 50 cents le plus proche
    add_filter('woocs_raw_woocommerce_price', function($price) {
        return round($price * 2, 0) / 2;
    });
  • /round-prices-500/ - Comment arrondir les prix à 500
    add_filter('woocs_raw_woocommerce_price', function($price) {
        global $WOOCS;
       /*
        if ($WOOCS->current_currency === 'USD') {
            $price = round($price + 0.01) - 0.01;
        }
    */
    
        if (($price <= 1000))
        {
            $price = round($price / 1000, 0) * 1000;
            return $price;
        } else
        {
            $price = ceil($price / 500) * 500;
            return $price;
        }
    });
  • /how-to-round-price-to-99-cents/ - Comment arrondir les prix à x.99

Lire aussi : /hook/woocs_woocommerce_variation_prices/