Vendemmia (2 di 2)
da admin_ib | Nov 16, 2017 | Varie | 0 commenti
/* * Get the total quantity of the product available in the cart. */ function wc_qty_get_cart_qty( $product_id ) { global $woocommerce; $running_qty = 0; // iniializing quantity to 0 // search the cart for the product in and calculate quantity. foreach($woocommerce->cart->get_cart() as $other_cart_item_keys => $values ) { if ( $product_id == $values['product_id'] ) { $running_qty += (int) $values['quantity']; } } return $running_qty; } function wc_qty_get_cart_totals_items_qty() { global $woocommerce; $running_total_qty = 0; // iniializing quantity to 0 // search the cart for all product in and calculate quantity. foreach($woocommerce->cart->get_cart() as $other_cart_item_keys => $values ) { if ( true ) { $running_total_qty += (int) $values['quantity']; } } return $running_total_qty; } ?>