Linked Questions

2
votes
1answer
11k views

Magento 2 programatically add product to cart? [duplicate]

We have a requirement that we wants to add product to cart programmatically in magento2.
1
vote
3answers
5k views

Get quote item id after product added to cart in observer

I am working on a custom module where a single product of a certain sku (say fixed-product) will be added to cart multiple times, but with different custom options programmatically. I also need to ...
4
votes
2answers
2k views

Add custom div before main content in magento2

I am trying to add my custom div with class and id before the maincontent. <main id="maincontent" class="page-main"> can i add the custom div before this line? How this can be done. Please ...
4
votes
2answers
4k views

When Quote id generated in magento?

When Quote id generated in magento? Is it generated: when customer got registered or when customer adds product to cart. I have gone through many article but there is no clearance on it.
4
votes
1answer
4k views

Set custom price of product when adding to cart code not working

I have write module for set custom price of product when adding to cart but my code not working. namespace Navin\Testcart\Observer; use Magento\Framework\Event\ObserverInterface; ...
4
votes
3answers
686 views

Remove specific shipping method based on condition in magento 2

I have installed a store pick up extension in our website. This extension showing two option as radio buttons Collect in Store Yes No So if we select 'NO', then in shipping method, There is an ...
0
votes
2answers
818 views

Add multiple items to cart in Magento2

I am implementing add to cart functionality from ajax using product id. This is my code of template file <tr class="border_bottom child-items selected"> <td >...
0
votes
2answers
190 views

send custom product price to checkout on add to cart in magento2

I have a custom price in phtml which is shown in the product page.Now I want to send that price to checkout page on add to cart click in magento2 that custom price is coming in js variable and input ...
1
vote
0answers
139 views

Add multiple products in cart programatically magento 2

I am trying to add multiple products in cart programmatically. This below code is working properly but I need to set quantity dynamically. If quantity is not set that product to be skipped without ...
0
votes
1answer
77 views

Get Product info from afterAddProduct Plugin in magento 2

I have a custom functionality for add to cart in product detail page. Once button clicked, sending product id and adding product to the cart. Used below code to implement it. <input type="hidden"...
0
votes
2answers
59 views

In magento2 how to override a add to cart button in both product list and product details page in custom module

Product detail page: Category Product list catalog_product_view.xml <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:...