コード例 #1
0
 /** Ajax action to reload mini cart */
 public static function wps_reload_mini_cart()
 {
     $wps_cart = new wps_cart();
     $result = $wps_cart->mini_cart_content(sanitize_title($_POST['type']));
     $count_items = !empty($_SESSION) && !empty($_SESSION['cart']) && !empty($_SESSION['cart']['order_items']) ? $wps_cart->total_cart_items($_SESSION['cart']['order_items']) : 0;
     $free_shipping_alert = wpshop_tools::create_custom_hook('wpshop_free_shipping_cost_alert');
     echo json_encode(array('response' => $result, 'count_items' => $count_items, 'free_shipping_alert' => $free_shipping_alert));
     die;
 }