Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AshlinRejo/c893e3ce2c80eeb1ddda896a569e9fab to your computer and use it in GitHub Desktop.
Save AshlinRejo/c893e3ce2c80eeb1ddda896a569e9fab to your computer and use it in GitHub Desktop.
Discount rules v2: Fix for Mini cart doesn't refresh in woodmart
if ((isset($_REQUEST['wc-ajax']) && ($_REQUEST['wc-ajax'] == 'add_to_cart' || $_REQUEST['wc-ajax'] == 'remove_from_cart')) || (isset($_REQUEST['action']) && $_REQUEST['action'] == 'woodmart_ajax_add_to_cart')) {
add_action('woocommerce_mini_cart_contents', function (){
if (!WC()->cart->is_empty()){
WC()->cart->calculate_totals();
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment