Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
1 answer
436 views

Trying to listen to the add to cart event

This is my first time playing around with Magento. I'm building a module and I want to listen when a product is added to the cart so, I've tried to use the ...
kevkevdev's user avatar
0 votes
2 answers
20 views

Can not add2cart grouped product when 1 input field is diabled

I need to disable the input field when customergroup = 0 or 1 and quantity is < 0 but when I add the argument 'disabled' to the input, the add2cart button does not put the other available items in ...
Rene Donkers's user avatar
0 votes
2 answers
1k views

how to add product to cart in magento 2 using custom controller?

I have tried the following controller file to add product to cart in my custom extension. <?php namespace MS\Recommendeditems\Controller\Index; class Index extends \Magento\Framework\App\Action\...
Saurabh Magespider's user avatar
1 vote
0 answers
288 views

Magento 2 Remove Add to Cart button and Add New Custom Button

I am creating a module. I have create one custom product attribute which value is YES/NO. if product attribute value is Yes then Add to Cart Button hide And Show Custom Button if product attribute ...
Msquare's user avatar
  • 9,328
2 votes
2 answers
611 views

Magento 2: Disable add to cart button for certain products in category page

I am doing a custom module and now I want to hide the 'add to cart' button for certain products. I have followed the https://magenticians.com/magento-2-disable-add-to-cart-button/ documentation and i ...
Sanjun Dev's user avatar
3 votes
1 answer
2k views

Magento 2: After adding products to cart programmatically, cart is not refreshing until reloading page

Hello Magento 2 Friends. I have an ajax call to an controller, which adds some new products to the cart programmatically. This works fine, but the problem is that the cart and the mini cart are only ...
Felix Schönherr's user avatar
2 votes
1 answer
1k views

Magento 2: Add multiple products to cart programmatically does not work if cart is empty!

I have the same problem as mentioned in this Question: Magento 2: Add multiple products to cart programmatically But it was never answered. This is my Controller.php: <?php namespace MassiveArt\...
Felix Schönherr's user avatar
3 votes
2 answers
4k views

Magento 2 . How to hide 'Add to cart' button while not logged in

This is how I tried but its not working Bodak/DisableAddToCart/etc/adminhtml/system.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
Asad Khan's user avatar
  • 1,486
1 vote
0 answers
385 views

How to Hide Add to cart button in Magento 2 front end without editing phtml file

I created a custom module which has option to enable / disable Add to cart button in front end , I'm trying to hide button without editing the core templates files , is there any way to implement it . ...
Manohar singh's user avatar
16 votes
5 answers
19k views

How to "add to cart" a product with custom input field and save it to Database?

I had created a custom module in which I am overriding the add to cart form on the product page, and I successfully did it with catalog_product_view.xml file. Now I can see a custom input field on the ...
Fayyaz Khattak's user avatar
0 votes
1 answer
737 views

Magento 2 Pre-Order instead of Add to Cart

I need to be able to change the "Add to Cart" button to "Pre Order", or "Learn More", depending on a custom product attribute, release date. Any help will be appreciated.
ricker41's user avatar
0 votes
1 answer
5k views

Custom add to cart form

I would like to create my own custom add to cart form which is the same as original but with custom retrived products. How would I do that in a custom block? the block class <?php namespace ...
deroccha's user avatar
  • 687