I making a promo on Magento 2.4.5 Like buy any specific 5 products and get 1 free. We have products having FPT on them. I want to add this FPT product to cart with 0 price and 0 FPT when someone buy 5 products.
I have achieved this promo by using this event
checkout_cart_product_add_after
and using this code
$product = $this->productRepository->get($productSku);
$product->setTaxClassId(0);
// If the product is not in the cart, create a new item
$item = $this->quoteItemFactory->create();
$item->setProduct($product);
$item->setQty($freeQtyToAdd); // Set the quantity
// Set the final price of the item to 0
$item->setCustomPrice(0);
$item->setOriginalCustomPrice(0);
// Remove FPT
$item->setTaxAmount(0);
$item->setName('text name');
// Add the item to the cart
$quote->addItem($item);
$quote->collectTotals(); // Recalculate totals
$quote->save();
Product price get 0 and its adding to cart but the issue I am having is the price is 0 but its still showing FPT on this product. I want to remove PFT as well.