woocommerce_cart_totals_before_order_total

ACTION woocommerce\templates\cart\cart-totals.php (ligne 95) github
Cart totals This template can be overridden by copying it to yourtheme/woocommerce/cart/cart-totals.php. HOWEVER, on occasion WooCommerce will need to update template files and you (the theme developer) will need to copy the new files to your theme to maintain compatibility. We try to do this as little as possible, but it does happen. When this occurs the version of the template file will be bumped and the readme will list any important changes.
traduction française
Cart totals Ce modèle peut être remplacé en le copiant dans yourtheme/woocommerce/cart/cart-totals.php. CEPENDANT, il arrive que WooCommerce doive mettre à jour les fichiers du modèle et que vous (le développeur du thème) deviez copier les nouveaux fichiers dans votre thème pour maintenir la compatibilité. Nous essayons de le faire le moins possible, mais cela arrive. Lorsque cela se produit, la version du fichier de template sera augmentée et le readme listera les changements importants.

Paramètres

Entrée :
N/A
Sortie :
N/A

Utilisation

Ajouter une ligne dans le récapitulatif du panier

Insérer des informations avant le total de la commande

cart ui
// Ligne personnalisée dans récapitulatif
add_action('woocommerce_cart_totals_before_order_total', 'ligne_recap_personnalisee');

function ligne_recap_personnalisee() {
    $cart_total = WC()->cart->get_total('');
    $points_gagnes = floor($cart_total);
    
    echo '';
    echo 'Points de fidélité';
    echo '+' . $points_gagnes . ' points';
    echo '';
}

Actualités

Chargement des actualités...