Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [plugin]

Denotes questions about Magento 2 Plugins (BeforePlugin , AfterPlugin and AroundPlugin). Plugins are also known as interceptors in the Magento documentation.

Filter by
Sorted by
Tagged with
0 votes
0 answers
14 views

Help Finding Extension: Surcharge on product (M2)

We sell cleaning chemicals (B2B) and the state requires a VOC tax for each sale, which must be shown separately. For accounting reasons, we are looking for a more specialised solution. Simply charging ...
Phil's user avatar
  • 1
0 votes
0 answers
20 views

Custom Attribute not saving into the Sales_Order Table

This is my PLugin : <?php namespace Vendor\Module\Plugin; use Magento\Sales\Api\Data\OrderItemExtensionFactory; use Magento\Sales\Api\Data\OrderItemInterface; use Magento\Sales\Api\Data\...
Rana Zain's user avatar
  • 658
1 vote
1 answer
55 views

Magento 2 extension submission to the marketplace was failed

"command": "composerConfigRepository0", "output": [ "Finished with the '0' exit code." ...
Radhu's user avatar
  • 179
2 votes
1 answer
165 views

Error: Cannot instantiate interface Magento\Catalog\Model\Layer\ContextInterface Magento Plugin

I've created a plugin in Magento 2.4.5 to overwrite Magento\CatalogSearch\Model\Layer\Filter\Price 's method. <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/...
Yaroslav's user avatar
0 votes
0 answers
24 views

Magento 2 Compile Void on <directory> in line 20

I have updated one of my plugin versions (payment plugin) to the most recent version and after running bin/magento setup:upgrade i run the comand : bin/magento setup:di:compile which gives me the ...
Omar Mohamed's user avatar
0 votes
0 answers
73 views

How can I set a different home page depending on customer group (including people not logged in) on Magento 2.4?

I want to change homepage based on customer group. I tried defining a plugin in this post Magento 2: Change hompage on login , But it doesn't seem to work for me. I could override the CMS default ...
Michel Meyran's user avatar
0 votes
0 answers
39 views

How to Bundle products based on customer selection?

What is the best approach to achieve a step-by-step walkthrough experience, prompting customers to select items from 3 categories and sell them as a bundle with a single dynamic price during checkout? ...
Nxlevel's user avatar
  • 407
0 votes
0 answers
68 views

Magento 2: Add custom value to $parent in checkout summary

I want to add a custom value to the items in the order summary during checkout ($parent). I followed all the other howtos on how to do it: Create plugin for Magento\Checkout\Model\...
omsta's user avatar
  • 698
0 votes
2 answers
54 views

Before Plugin asks for the class argument

I am new to Magento and following a course, yet some things hold me back. I really want to learn it but my only duties are as a frontend developer. If you could guide me through this problem it would ...
HakunaMatata's user avatar
0 votes
2 answers
31 views

Magento 2 - Class doesn't Exists when compiling

I tried to create a simple plugin (magento 2.4.3-p1) : But when I run the compiler, I have the following error : In PluginListGenerator.php line 326: Plugin class Fseb\ModuleA\Plugin\Catalog\Model\...
ILOA's user avatar
  • 3
0 votes
0 answers
25 views

New custom field I added to plugin is not writing to the db

I have a Magento 2.4.6 store. We are using the Mageworks Options Extended plugin. I need to add a field. They have a nice blog about how to do so but it seems from a few years ago: https://www....
atomic-ag's user avatar
1 vote
2 answers
69 views

Magento 2 - after Plugin for \Magento\Csp\Model\Policy\FetchPolicy not working

Why is my plugin not getting called? app/code/Company/Configurator/etc/module.xml: <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
Black's user avatar
  • 3,369
1 vote
1 answer
25 views

Plugin for Magento\Setup\Model\ConfigOptionsList::validate

Is it possible to make a plugin for Magento\Setup\Model\ConfigOptionsList::validate()? This function checks the validity of connection to DB and since I am dynamically generating password for DB, I ...
InToSSH's user avatar
  • 11
0 votes
1 answer
116 views

2.4.6: Filter available attribute sets according to product type, using a plugin

In my custom plugin, the InstallData.php script creates a custom attribute set. For the purposes of this Q&A, we will call it 'Custom Attribute Set #1'. I would like the attribute set to only be ...
Muckee's user avatar
  • 699
0 votes
1 answer
60 views

Magento2 How to translate City names in the Arabic language

How to translate City names in the Arabic language. here is the screenshot. https://i.imgur.com/2UVdzrJ.png I can not translate city names on my account page.
Ekta's user avatar
  • 101
0 votes
3 answers
538 views

How can I remove a condition from a collection

I tried to use two methods to reset or clear the collection but it didn't work. I am working with the category collection on which I want to remove this part of the condition : (e.created_in <= '...
Alok Tiwari's user avatar
0 votes
0 answers
111 views

Magento 2 - override private method in abstract class

Is there a way to override a private method of an abstract class in magento 2? I need to override the private method correctText of Magento\Sales\Model\Order\Pdf\AbstractPdf
Black's user avatar
  • 3,369
0 votes
1 answer
39 views

How i override or create plugin product applier?

I am trying to create plugin product applier but not succeed. I am trying to send email when content goes live, so i schedule product and goes live then send a push email when i send 10 product update ...
Alok Tiwari's user avatar
0 votes
1 answer
29 views

How to use plugin for Magento\Cms\Controller\Adminhtml\Wysiwyg\Images\Thumbnail execute() function

I want to put an around plugin. This is the core file vendor/magento/module-cms/Controller/Adminhtml/Wysiwyg/Images/Thumbnail.php The main purpose is on the execute function I want to upload a custom ...
Tj1997's user avatar
  • 47
1 vote
1 answer
153 views

magento 2 : How to create module in pwa studio

Regarding pwa module development How to create module in pwa studio? how we can apply current custom magento plugin in pwa ??
user110925's user avatar
0 votes
0 answers
140 views

Hot to create plugin for savePaymentInformationAndPlaceOrder method

This method is calling at checkout step but with plugin using after method it's not calling, core method is calling. etc/di.xml <type name="Magento\Checkout\Model\PaymentInformationManagement&...
Jimit Bhavsar's user avatar
0 votes
0 answers
233 views

Magento 2.4 : How to save delivery comment in order and in database?

I'm using Magento 2.4.4 and PHP 8.1 . How can i use the order comment as show in screenshot but use it in shipping method as delivery comment and save comment in sales_order &quote table? I have ...
Bayzel's user avatar
  • 187
0 votes
1 answer
166 views

Plugin SortOrder

I was reading plugin documentation and I was wondering, if there is a plugin with SortOrder=0 how can i excute another plugin before that one, would SortOrder=-1 work? Is that a bad practice? Is there ...
Simse's user avatar
  • 35
1 vote
1 answer
149 views

Can I use sitemap_products_generating_before event to modify Product Sitemap in Magento2?

In Magento 1, sitemap_products_generating_before event allows us to modify the Product Sitemap. Can I use sitemap_products_generating_before event names in Magento 2.4? I want to filter the product ...
mr.hironobu's user avatar
0 votes
2 answers
739 views

Magento 2 Certification Question - How can a developer prioritize a plugin's execution, if possible?

How can a developer prioritize a plugin's execution, if possible? A. The developer can use sortOrder property by specifying a higher value than the target plugin. B. This cannot be achieved as the ...
Wakar Ahamad's user avatar
1 vote
2 answers
375 views

Magento 2 - Send data into a new quote_item column from an API call

I have added a new column in quote_item table and want to add this field as a parameter in cart API payload but I don't how this will happen. This is what I get when i try to hit add to cart api. ...
Asad Ali's user avatar
0 votes
2 answers
288 views

How to override CartItemInterface class in in my custom model?

I have to add 2 new methods getter and setter in CartItemInterface but i am facing issues. Basically I have added a new column in quote item table and now I want to add this column in cart api. Please ...
Asad Ali's user avatar
0 votes
1 answer
281 views

Change the variable to the coming function from before plugin

I would like to change the variable - $validate to false from before the plugin. May I know how to do it? app/code/MyModule/ReviewCheck/Plugin/ReviewModel.php <?php namespace MyModule\ReviewCheck\...
hill2011's user avatar
0 votes
1 answer
232 views

How can i get order data using credit memo plugin in Magento 2?

Here I used the credit memo plugin for updating the order data after refund success so how can I get order data in that function? etc/adminhtml/di.xml <?xml version="1.0"?> <...
Jay Parmar's user avatar
2 votes
2 answers
3k views

Class "Magento\Framework\Component\ComponentRegistrar" not found in setup/src/Magento/Setup/registration.php:9

When I run "composer install or "composer update" command from my magento 2.4.5 root folder I am getting this error. - Installing laminas/laminas-dependency-plugin (2.4.0): Extracting ...
shankar boss's user avatar
  • 1,453
1 vote
0 answers
176 views

Custom Validation rule doesn`t works in shipping address

Hi dears I have going crazy to add a custom validation to vat field. I tried several ways, but I don't get an solve, I don't know why?! I have a module Vendor/module i have create a custom rule ...
Peren's user avatar
  • 27
0 votes
3 answers
76 views

How to override taxvat.phtml

Hi dears I want to override taxvat.phtml in vendor > magento > module-customer > view > frontend > templates > widget Before I try to create a file Vendor > Module > etc > ...
Peren's user avatar
  • 27
5 votes
1 answer
2k views

How can I change the shipping price at checkout with an observer or plugin?

The shipping method may be flatrate or FedEx or freeshipping, but I want to override this price with $1. How can I do this?
Justin Collins's user avatar
2 votes
0 answers
585 views

Magento 2 checkout, I need to display or hide a shipping method depending on if a coupon code was entered and is valid. How can I do this?

I have a price rule attached to the flat rate shipping method as an option, and I want to intercept when the coupon is added, so that I can hide this flat rate method unless the coupon code matches ...
Justin Collins's user avatar
0 votes
2 answers
215 views

override checkout index controller

I would like to override only one line in checkout/index/index controller. do I need to use preference or plugin or observer? if (!$this->_customerSession->isLoggedIn() && !$...
sivakumar's user avatar
  • 277
1 vote
0 answers
241 views

Magento 2.4 Plugin afterGetPrice() - issues with Full Page Cache

I am overriding the frontend price by using the Magento\Catalog\Model\Product plugin like so: Sulman/Mymodule/etc/frontend/di.xml <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&...
sulman's user avatar
  • 529
0 votes
1 answer
475 views

Magento 2: How to override the core interface and add a new constant?

I need to extend the core interface Magento\NegotiableQuote\Api\Data\NegotiableQuoteInterface and need to add a new constant but when I override the interface via preference its not working. When I ...
MagentoDev's user avatar
0 votes
1 answer
498 views

Order Updated At Date same as Created At

I am using the after plugin for the Place method following this link https://www.rakeshjesadiya.com/create-plugin-after-place-order-action-checkout-magento-2/ But I get the order updated at the date ...
Vishwanath Kharabe's user avatar
1 vote
0 answers
296 views

Magento 2.3.7-p3 Unable to save extension attribute to Quote Item

I want to show customers how many 'points' they could be making, per quote item, on each item row of the basket. Using extension attributes, this is what I have: di.xml <type name="Magento\...
Surreal Disco's user avatar
0 votes
2 answers
810 views

How to change the parameter being sent using a Before Plugin?

I have a before Plugin that runs when a customer data is updated thru the admin. When "save customer" is clicked I need to update the values of some of the fields (like customerID) the form ...
joguz's user avatar
  • 39
1 vote
2 answers
234 views

Observer that runs when an order is attempted to be created in the Admin

I need to create an observer or plugin or something else that will run when an order is attempted to be created through the admin. I added a custom attribute for customers (offline/online). If the ...
joguz's user avatar
  • 39
0 votes
1 answer
21 views

Include shipping on quote item not quote

What I'm trying to achieve During the checkout, if the customer has a Bike item in their basket, we want the shipping cost to be added as a product option to the cart item as opposed to being added to ...
Richard Parnaby-King's user avatar
0 votes
1 answer
170 views

Magento 2 Category rule and override the cart file by plugin

how do I can set up a rule in Magento 2 by category, If need to do something like this: I one product that is from one category is added to the cart then the customer can't add any product from ...
Robert's user avatar
  • 2,176
0 votes
2 answers
436 views

Magento 2 - automatically set product as new when CREATING product only

I want Magento (2.4) to set newly created products as new for specified period of time but only when product is created and not saved after being edited... So, I would need something very similar to ...
Twisted_Jar's user avatar
0 votes
2 answers
88 views

Magento 503/500 errors when products collection accessed

I have created a Magento (2.4) extension, which creates a custom product listing page in a specific route. It works well and loads a product listing with all products. Then I added following plugin ...
Indunil Ramadasa's user avatar
0 votes
1 answer
274 views

How can I intercept a sale order created from within the admin panel in Magento 2?

I need to write data to an extension attribute after the order is created from within the admin panel. The extension attribute is the admin user's first and last name. How do I intercept this the ...
Justin Collins's user avatar
1 vote
1 answer
258 views

How to intercept customer order in Magento 2?

When an order is submitted, I need to write data to extension attributes. I need to either create an event observer or plugin. How do I do this the right way?
Justin Collins's user avatar
0 votes
1 answer
813 views

Magento 2: How can I add new field and save data to newsletter database table?

How can I save data in a new field in newsletter table of database? This is how I created my module based on other answers, but no one of aproaches worked. The fields of column c_firstname is always ...
Hallan's user avatar
  • 1
0 votes
2 answers
800 views

Magento 2.4: Which event triggers when the category page is loaded in magento2?

I want to know which event is triggered when a category page is loaded from the megamenu? I want to load a custom collection of data based on a particular category.
mechanic's user avatar
  • 440
0 votes
1 answer
820 views

How do I extend/override \Magento\Theme\Block\Html\Topmenu::_getMenuItemClasses?

I cannot find it di.xml. Any ideas? I want to add a custom css class to specific TopMenu items. I don't know how to extend this.
Justin Collins's user avatar

1
2 3 4 5
13