简体   繁体   中英

Amount of products added to cart

I am trying to set a item price based on other products added to the cart,

eg if there are 4 products 'table'(quantity 4) then product X should be +50€.

First of all i am checking if the product->getAttributeText('try') is not false.

In the second step i would like to see how many products are placed from this kind(table).

what i did was:

foreach ($cart->getAllItems() as $item) {
    $productQnty = $item->getProduct()->getQty();
}

But this is always null.

You should try using a "Shopping Cart Price Rule". Under Conditions, you can set it to only work if there are X number of products in the cart. If you need, you can also specify the rule to only work for a specific product.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM