All Questions
22 questions
9
votes
3
answers
2k
views
Magento 2: Which extension mechanism to choose?
We can extend controller in two ways: using preference and using plugin.
But I do not understand that, which one is good and advantages/disadvantages of preference vs plugin.
<preference for="...
5
votes
1
answer
1k
views
Plugin for aroundSavePaymentInformationAndPlaceOrder Throwing Error
I have a plugin that i want to intercept aroundSavePaymentInformationAndPlaceOrder, but it is giving me an error. Here is how it is set up:
Vendor/Module/etc/di.xml
<?xml version="1.0" ...
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:...
2
votes
2
answers
3k
views
How to override getSectionData() method of magento-checkout CustomerData/Cart.php?
Is it possible to overwrite "public function getSectionData()" of class magento-checkout/CustomerData/Cart.php only with the help of Plugin
My di.xml
<?xml version="1.0"?>
<config ...
2
votes
1
answer
1k
views
Magento 2 - Plugin to run only when function is called from specific module
Is there any way that I can specify that a Plugin X only runs when the class is called from Module Y?
So that if same function is called from other modules the Plugin is not called.
2
votes
0
answers
32
views
Creating custom 2FA provider
I'd like to enable the 2FA extension but I'd like to write my own provider (e.g. not Authy or Google Authenticator).
Anybody who can point me in the right direction? I have been working with ...
2
votes
0
answers
285
views
Magento 2: How do I load a cart populated by the REST API into the frontend?
Using the Magento REST API I am able to create and populate a cart on my external site, but I want customers to checkout on the actual Magento site. Right now I'm looking at creating a plugin for ...
1
vote
1
answer
221
views
Using Magento Framework as a dependency in module.xml
Currently I am working on a plugin that modifies the Search in Magento 2
The file that I am trying to intercept is located at:
\Magento\Framework\Search\Adapter\Mysql\Query\Builder
To be able to use ...
1
vote
1
answer
461
views
Hook and modify an email being sent by Magento 2
I am trying to find a way to modify my email letter content before sending it.
I want to be able to modify any email being sent by Magento.
For instance I need to achieve the following.
Be ...
1
vote
1
answer
2k
views
Magento 2: Is it possible to add additional general/store_information configuration through my custom module?
Reading articles relating to calling store name and other admin fields, this post specifically.
I'm creating a module (my first for Magento 2) for my client but want to add an additional field (...
1
vote
0
answers
206
views
Preference is not working while a method called from child class
I created a preference for the method _applyOptionsPrice() in Magento/Catalog/Model/Product/Type/Price.php class.
The preference is working while the _applyOptionsPrice() was called from the same ...
1
vote
0
answers
77
views
Plugin Grid not loading/block doesn't exist
So I have a plugin called Vendor/PluginName.
It's fairly simple and has a grid layout (view/adminhtml/layout/pluginname_index_grid.xml) that has the contents of ....
<?xml version="1.0" encoding=...
1
vote
0
answers
233
views
Magento 2 Change price for configurable product using plugin
I need to change price of products using plugin. I used following method for it.
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:...
1
vote
0
answers
37
views
How to create custom extension on Magento 2, or module or plugin [duplicate]
There are many tutorials available when people start to say: "Here is how to create custom Magento 2 extension". And then they start to describe how to create module, instead of the extension. So i ...
1
vote
1
answer
51
views
Trouble with cart add module
Trying to create a module that redirects the customer to the account creation page when they add to cart if they are not logged in, I have the following code in app/code/Mason/CheckoutRedirect/Plugin/...
0
votes
2
answers
446
views
Magento2 activate custom module that extended core module
lets say I've created a custom module that will extend some functionality as plugins from Magento_Catalog core module and lets call it MyModule.
MyModule has already been registered and activated.
I ...
0
votes
2
answers
4k
views
M2 Save custom attribute on Customer Group form
I've created a plugin to save an attribute on customer group form. The form input is a multi select, so I added a table field (string) in the customer_group database via updateSchema.php I figured ...
0
votes
1
answer
152
views
Is there any free EMI calculator extension in Magento 2? [closed]
I like to know is there any free EMI calculator extension in Magento 2?
Thanks
0
votes
0
answers
1k
views
Magento 2 prevent function from executing using plugins
There is a third party module which contain the RecurringData.php file.
That class has install function which runs $this->testimonial->update(); function. I want to stop the execution of that ...
0
votes
2
answers
626
views
Cannot add custom topmenu link with plugin
I want to add custom links to the topmen / a submenu in the topmenu (I need the links for custom filters). To achieve this, I have created a plugin:
app/code/Vendor/Module/etc/frontend/di.xml:
<...
0
votes
2
answers
1k
views
Error at checkout page; "ConfigProvider does not exist"
I'm new around and trying to update existing module. I didn't make many changes on working module, but just added 2 files (models), and 5 lines of code to write database extra fields. New ...
0
votes
1
answer
251
views
Why I'm getting Uncaught TypeError when creating a Magento 2 plugin?
I was trying to create a plugin for existing Magento 2 extension, but it is always getting Uncaught TypeError:
Fatal Error: 'Uncaught TypeError: Argument 1 passed to
Vinc\discount4customer\Plugin\...