windows 10 pro office 2019 pro office 365 pro windows 10 home windows 10 enterprise office 2019 home and business office 2016 pro windows 10 education visio 2019 microsoft project 2019 microsoft project 2016 visio professional 2016 windows server 2012 windows server 2016 windows server 2019 Betriebssysteme office software windows server https://softhier.com/ instagram takipçi instagram beğeni instagram görüntüleme instagram otomatik beğeni facebook beğeni facebook sayfa beğenisi facebook takipçi twitter takipçi twitter beğeni twitter retweet youtube izlenme youtube abone instagram

Insert a custom total excluding products cost row on cart and checkout totals in WooCommerce

Asked By: Anonymous

I can add an extra row to the checkout totals table with Insert a custom total row on cart and checkout totals in Woocommerce answer code. (albeit I need to add mine at the bottom) but I can’t find or figure out how to calculate the total that I need.

The total I need to add should include everything apart from the product cost (so should include shipping, VAT, fees etc.).

I can’t change the product prices to zero as they’re used for fee calculations.

My code attempt:

add_action( 'woocommerce_cart_totals_before_shipping', 'display_custom_total', 20 );
add_action( 'woocommerce_review_order_before_shipping', 'display_custom_total', 20 );
function display_custom_total() {
$total_to_pay = 0;
    // Do something here
 
        // The Output
        echo ' <tr class="cart-total-to-pay">
            <th>' . __( "Total to pay", "woocommerce" ) . '</th>
            <td data-title="total-to-pay">' . number_format($total_to_pay, 2) . '</td>
        </tr>';
}

How would I go about adding this to the checkout & cart page?


Solution

Answered By: Anonymous

To display it at the bottom, use woocommerce_cart_totals_after_order_total & woocommerce_review_order_after_order_total action hook instead.

So you get:

function display_custom_total() {
    // Get (sub)total
    $subtotal = WC()->cart->subtotal;
    $total = WC()->cart->total;
    
    // Calculate
    $total_to_pay = $total - $subtotal;
    
    // The Output
    echo ' <tr class="cart-total-to-pay">
        <th>' . __( 'Total to pay', 'woocommerce' ) . '</th>
        <td data-title="total-to-pay">' . wc_price( $total_to_pay ) . '</td>
    </tr>';
}
add_action( 'woocommerce_cart_totals_after_order_total', 'display_custom_total', 20 );
add_action( 'woocommerce_review_order_after_order_total', 'display_custom_total', 20 );

Related: Insert a custom total excluding products cost in WooCommerce order emails

techinplanet staff

Porno Gratuit Porno Français Adulte XXX Brazzers Porn College Girls Film érotique Hard Porn Inceste Famille Porno Japonais Asiatique Jeunes Filles Porno Latin Brown Femmes Porn Mobile Porn Russe Porn Stars Porno Arabe Turc Porno caché Porno de qualité HD Porno Gratuit Porno Mature de Milf Porno Noir Regarder Porn Relations Lesbiennes Secrétaire de Bureau Porn Sexe en Groupe Sexe Gay Sexe Oral Vidéo Amateur Vidéo Anal

Windows 10 Kaufen Windows 10 Pro Office 2019 Kaufen Office 365 Lizenz Windows 10 Home Lizenz Office 2019 Home Business Kaufen windows office 365 satın al follower kaufen instagram follower kaufen porno