Add fee on cart page using AJAX
-
Hello,
I want to add fee on cart page using AJAX. Below I write function for it.
function woo_add_cart_fee() { if ( ! $_POST || ( is_admin() && ! is_ajax() ) ) { return; } global $woocommerce; $extracost = 10; $woocommerce->cart->add_fee( 'Surcharge', $extracost, true, '' ); if(is_ajax()){ add_action('woocommerce_after_cart', 'cart_select_change_js', 10); echo wc_get_template( 'cart/cart-totals.php' ); exit; } }
It add extra fee in cart object but can’t update total value.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Add fee on cart page using AJAX’ is closed to new replies.