I have create a ajax call and added a product to cart programmatically. After that i have redirected to direct checkout page. Now mini cart shows similar to attached image. Point to be noted is cart display like below attached image if i add "Not Visible Individually" item in cart. However it works perfectly if product is set visible on catalog and search from admin.
How can it populate correctly ?
Add to cart code:
$productId = $this->getRequest()->getParam('id'); $params = array( 'form_key' => $this->formKey->getFormKey(), 'product' => $productId, 'qty' => 1 ); $_product = $this->product->load($productId); $this->cart->truncate(); $this->cart->addProduct($_product, $params); $this->cart->save();