function ajax_swr_update_payment_method() { global $woocommerce; $ret = array('rewards' => ''); check_ajax_referer('update-order-review', 'security'); $ret['rewards'] = swr_get_text_rewards(); echo json_encode($ret); die; }
function swr_update_cart_reward() { global $woocommerce; check_ajax_referer('update-shipping-method', 'security'); if (!defined('WOOCOMMERCE_CART')) { define('WOOCOMMERCE_CART', true); } if (isset($_POST['shipping_method'])) { $_SESSION['_chosen_shipping_method'] = $_POST['shipping_method']; } $woocommerce->cart->calculate_totals(); $msg = swr_get_text_rewards(); echo '<span class="updated_rewards" style="display:none;">' . $msg . '</span>'; }