This is my code to add some products to cart(quote):

foreach ($params as $param) {
   $product = $this->productRepository->getById($param['product']);
   $this->cart->addProduct($product, $param);

The $param variable looks like:

   'product' => //id of the product
   'qty' => 1

I found this : post, but it is about having a coupon code. I don't have any. Also, which columns from quotes table represents the total with the cart price rule applied ?

  • why don't ypu create shopping cart rule without coupon code, once your cart matches the cart rule conditions magento automatically apply that rule. Commented Dec 17, 2020 at 10:54
  • @RanjitShinde , I thought i need to add it manually. I didn't know that it is automatically. And where can i see that ? in the database ? the total amount applied and the final total ? Commented Dec 17, 2020 at 10:55
  • No we don't need to add it manually. You can see that in magento admin->Marketing -> Promotions -> Cart Price Rules Commented Dec 17, 2020 at 10:57
  • I mean the total amount with the rule applied in the quote columns. For some reason i cannot find it. there are too many totals Commented Dec 17, 2020 at 10:58
  • 2
    table quote and grand_total is the final total. You can check applied_rule_ids in the quote as well as quote_item table Commented Dec 17, 2020 at 11:00


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.