Skip to content

Instantly share code, notes, and snippets.

@bhavik-kiri
Last active June 21, 2017 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhavik-kiri/2f6701deda5a0af4c06cb69130927968 to your computer and use it in GitHub Desktop.
Save bhavik-kiri/2f6701deda5a0af4c06cb69130927968 to your computer and use it in GitHub Desktop.
It will modify the quantity & calculate the total of the cart
<?php
function update_order_review() {
$values = array();
parse_str($_POST['post_data'], $values);
$cart = $values['cart'];
foreach ( $cart as $cart_key => $cart_value ){
WC()->cart->set_quantity( $cart_key, $cart_value['qty'], false );
WC()->cart->calculate_totals();
woocommerce_cart_totals();
}
wp_die();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment