public function ins_ajax_refresh_cart() { global $woocommerce; $cart_id = isset($_POST['cart_id']) ? $_POST['cart_id'] : ''; if (isset($woocommerce->cart->cart_contents[$cart_id])) { $product = isset($_POST['product_id']) ? get_product($_POST['product_id']) : ''; $cart_item = $woocommerce->cart->cart_contents[$cart_id]; if (isset($_POST['quantity'])) { if ($cart_item['quantity'] != (int) $_POST['quantity']) { $woocommerce->cart->set_quantity($_POST['cart_id'], $_POST['quantity'], false); } } } //get item detail html ob_start(); load_cart_contents(); $template = ob_get_clean(); //Define WooCommerce cart for grandtotal calculation define('WOOCOMMERCE_CART', true); //Calculate totals for display $woocommerce->cart->calculate_totals(); $this->json_return['errors'] = $woocommerce->cart->check_cart_coupons(); //Get cart totals for display $subtotal = $woocommerce->cart->subtotal_ex_tax; $discount = $woocommerce->cart->get_cart_discount_total(); $total_tax = $woocommerce->cart->tax_total; $total = $woocommerce->cart->total; if ($order_id = $woocommerce->session->order_awaiting_payment) { $tendered = get_post_meta($order_id, 'payment_tendered') ? get_post_meta($order_id, 'payment_tendered', true) : '0'; } else { $tendered = 0; } //Load data for AJAX $this->json_return = array('success' => true, 'call' => 'refresh_display', 'html' => $template, 'ins_subtotal' => wc_price($subtotal), 'ins_disc_total' => '(' . wc_price($discount) . ')', 'ins_tax_total_label' => strtoupper($woocommerce->countries->tax_or_vat()), 'ins_tax_total' => wc_price($total_tax), 'ins_grand_total' => wc_price($total), 'tendered_amount' => wc_price($tendered)); $products = ins_get_products(); foreach ($products as $product) { $buttons = ''; ob_start(); ins_refresh_products($product); $buttons .= ob_get_clean(); $this->json_return['buttons'] = $buttons; } //Send data to JS echo json_encode($this->json_return); die; }
">SKU - <?php echo esc_html($product->get_sku()); ?> </option> <?php } } ?> </optgroup> </select></td> </tr> </table> </div> <div class="product_explorer scroll"> <?php ins_refresh_products(); ?> </div> <div class="payment_options"> <ul class="payments"> <?php foreach ($payment_methods as $method) { ?> <li class="payment_gateway function_button <?php echo esc_attr($class); ?> " id="<?php echo esc_attr($method->id); ?> " title="<?php echo esc_attr($method->title);