public function set_quantity($cart_item_key, $quantity = 1, $refresh_totals = true)
{
if (0 == $quantity || $quantity < 0) {
do_action('woocommerce_before_cart_item_quantity_zero', $cart_item_key);
unset($this->cart_contents[$cart_item_key]);
} else {
$old_quantity = $this->cart_contents[$cart_item_key]['quantity'];
$this->cart_contents[$cart_item_key]['quantity'] = $quantity;
do_action('woocommerce_after_cart_item_quantity_update', $cart_item_key, $quantity, $old_quantity);
}
if ($refresh_totals) {
$this->calculate_totals();
}
return true;
}