Woocommerce批量增加或减少购物车中的产品数量

时间:2018-12-12 18:13:33

标签: wordpress woocommerce

在我的woocommerce购物车(可变产品)上,我必须批量增加购物车中产品的数量,这意味着如果我增加一种产品的数量,则在重新加载页面时其他产品也应增加。

这是我的代码:

foreach ( $cart->cart_contents as $k => $cart_content ) {
    $items[$cart_content['variation_id']][$qty] = $k;
}
// loop over $items
foreach($items as $item){
    $woocommerce->cart->set_quantity($item, HOW_COULD_I_INCREASE_QTY_HERE);
}

谢谢。

0 个答案:

没有答案