Skip to content

Instantly share code, notes, and snippets.

@clifgriffin
Last active December 18, 2015 19: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 clifgriffin/5833433 to your computer and use it in GitHub Desktop.
Save clifgriffin/5833433 to your computer and use it in GitHub Desktop.
add_action('wp_ajax_update_shipping', 'update_shipping');
add_action('wp_ajax_nopriv_update_shipping', 'update_shipping');
function update_shipping() {
// Update shipping
$dest = array(
'shipping' => array(
'postcode' => $_REQUEST['postcode'],
'country' => $_REQUEST['country']
)
);
ShoppOrder()->Shipping->locate($dest);
ShoppOrder()->Cart->changed(true);
ShoppOrder()->Cart->totals();
echo json_encode(ShoppOrder()->Cart->shipping);
die;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment