if (fflcommerce_cart::get_cart_shipping_total()) { ?> <tr> <th class="cart-row-shipping-title"><?php _e('Shipping', 'fflcommerce'); ?> <small><?php echo _x('To: ', 'shipping destination', 'fflcommerce') . __(fflcommerce_customer::get_shipping_country_or_state(), 'fflcommerce'); ?> </small> </th> <td class="cart-row-shipping"><?php echo fflcommerce_cart::get_cart_shipping_total(true, true); ?> <small><?php echo fflcommerce_cart::get_cart_shipping_title(); ?> </small> </td> </tr> <?php } ?> <?php if (fflcommerce_cart::show_retail_price() && $options->get('fflcommerce_prices_include_tax') == 'no') { ?> <tr> <th class="cart-row-subtotal-title"><?php _e('Subtotal', 'fflcommerce'); ?> </th>
function fflcommerce_ajax_update_item_quantity() { /** @var fflcommerce_cart $cart */ $cart = fflcommerce_cart::instance(); $cart->set_quantity($_POST['item'], (int) $_POST['qty']); $items = $cart->get_cart(); $price = -1; if (isset($items[$_POST['item']])) { $item = $items[$_POST['item']]; /** @var fflcommerce_product $product */ $product = $item['data']; $price = apply_filters('fflcommerce_product_subtotal_display_in_cart', fflcommerce_price($product->get_defined_price() * $item['quantity']), $item['product_id'], $item); } if (fflcommerce_cart::show_retail_price()) { $subtotal = fflcommerce_cart::get_cart_subtotal(true, false, true); } else { if (fflcommerce_cart::show_retail_price() && FFLCommerce_Base::get_options()->get('fflcommerce_prices_include_tax') == 'no') { $subtotal = fflcommerce_cart::get_cart_subtotal(true, true); } else { $subtotal = fflcommerce_cart::$cart_contents_total_ex_tax + fflcommerce_cart::$shipping_total; $subtotal = fflcommerce_price($subtotal, array('ex_tax_label' => 1)); } } $tax = array(); foreach (fflcommerce_cart::get_applied_tax_classes() as $tax_class) { if (fflcommerce_cart::get_tax_for_display($tax_class)) { $tax[$tax_class] = fflcommerce_cart::get_tax_amount($tax_class); } } $shipping = fflcommerce_cart::get_cart_shipping_total(true, true) . '<small>' . fflcommerce_cart::get_cart_shipping_title() . '</small>'; $discount = '-' . fflcommerce_cart::get_total_discount(); $total = fflcommerce_cart::get_total(); echo json_encode(array('success' => true, 'item_price' => $price, 'subtotal' => $subtotal, 'shipping' => $shipping, 'discount' => $discount, 'tax' => $tax, 'total' => $total)); exit; }