Change the cart item quantity for specific products in woocommerce
问题 Can I change WooCommerce quantity in some specific product? I have tried: global $woocommerce; $items = $woocommerce->cart->get_cart(); foreach($items as $item => $values) { $_product = $values['data']->post; echo "<b>".$_product->post_title.'</b> <br> Quantity: '.$values['quantity'].'<br>'; $price = get_post_meta($values['product_id'] , '_price', true); echo " Price: ".$price."<br>"; } How to get specific product Id in cart? 回答1: To change quantities, see after that code. Here your revisited