You need to follow these steps to auto add a product to the cart programmatically in our Magento 2 extension