Update cart shipping data with AJAX in WooCommerce
问题 I'm trying to update my checkout cart's shipping with AJAX... I've got the action in functions.php function jwd_update_shipping() { WC()->cart->calculate_shipping(); echo "hi"; die(); } add_action('jwd_update_shipping_callback', 'jwd_update_shipping'); Then in js I call it, like so jQuery.ajax({ type: "POST", url: 'MYSITE.com/wp-admin/admin-ajax.php', data: ({ action: "jwd_update_shipping" }), success: function(response) { console.log("got this: " + response); if (response.type == "success")