jeudi 14 avril 2016

woo_add_cart_fee not working

add_action( 'woocommerce_calculate_totals', 'woo_add_cart_fee' );

i am using this hook for add extra amount charges in cart total amount. if i give static value in this function this work properly and add extra amount charges in cart total amount but when i give extra amount in hidden field post and value in session variable then this not add extra amount charges in cart to total. i also check value is exist in session variable when i echo session variable then show value on checkout page but place order button become disable.

function woo_add_cart_fee() {

    $_SESSION["extra_price2"]=$_POST["mounting_amount"];

    $abcs = (int) $_SESSION["extra_price2"];

    global $woocommerce;

    $woocommerce->cart->add_fee( __('Ship Installer Fees', 'woocommerce'), $abcs );

}

please help



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire