I need to integrate small stuff.
When I will click add to cart ( bundle product ) then only product added successfully in cart page and then redirect into the checkout page.
So please let me help. Please make sure only bundle product.
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityYou can use observer/event at here.
Create Observer event on checkout_cart_add_product_complete
.
and set return return_url
to request Url as checkout page url when you doing to add to cart.
<?php
namespace StackExchange\Magento\Observer;
use Magento\Framework\Event\ObserverInterface;
class CheckoutCartAddProductComplete implements ObserverInterface
{
/**
* @var \Magento\Framework\UrlInterface
*/
private $url;
public function __construct(
\Magento\Framework\UrlInterface $url
) {
$this->url = $url;
}
public function execute(\Magento\Framework\Event\Observer $observer)
{
$product = $observer->getEvent()->getProduct();
$request= $observer->getEvent()->getRequest();
if($product->getTypeId() !== 'bundle'){
return ;
}
/**
*
*/
$checkoutUrl = $this->url->getUrl('checkout');
$request->setParam('return_url',$checkoutUrl);
return $this;
}
}
Note that: This solution is work When Setting when After Adding a Product Redirect to Shopping Cart
= Yes
.