Questions tagged [around-plugin]

Denotes questions about Magento 2 AroundPlugins. For general questions use "plugin" tag.

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

magento 2.4 work with requests in aroundExecute()

I have a magento ajax execute method that gets parameters from the ajax requests, calls the magento objects using those parameters, then return a json response, something like this: $credentials = $...
  • 309
0 votes
2 answers
263 views

around plugin error | too few to function ::resolve()

This function runs around the resolve function for coupon api on Graphql, once the core function throws exception this function will catch and update the error message. core file [module-quote-graph-...
  • 31
0 votes
1 answer
335 views

Around plugin usage in Magento2

I have to override the file Magento\ConfigurableProduct\Helper\Data.php into my custom module I have few changes in the function getOptions public function getOptions($currentProduct, $...
  • 175
0 votes
1 answer
110 views

How to override core plugin method?

I would like to override core plugin method Core plugin path Magento\InventorySales\Plugin\StockState\CheckQuoteItemQtyPlugin.php In this file I would like to override aroundCheckQuoteItemQty() ...
1 vote
1 answer
267 views

About performance: Is better to use before and after plugin instead around always when possible?

About use of each kind of interceptor (plugin) was answered here: Is it better to use solely around function instead of before+after combined? But in Magento docs says: Avoid using around method ...
0 votes
1 answer
54 views

Can the round method be intercepted?

I'm trying to override the round method in \vendor\magento\module-directory\Model\PriceCurrency.php. This is the method: /** * @inheritdoc */ public function round($price) { return round($price, ...
1 vote
1 answer
118 views

Product compare plugin not working

Here is the plugin i created for limiting 3 products can be added into comparison. But it not loading, add one know what is the problem? etc/frontend/di.xml <?xml version="1.0"?> <...
  • 2,151
1 vote
1 answer
94 views

Magento 2 : override abstarct class method

I want to override mone method prepare of class Magento\Ui\Component\Form\Element\AbstractOptionsField I tried to do with preference but there is no effect I also tried using plugin but it throws ...
  • 1,039
2 votes
2 answers
1k views

Magento2 Around Plugin vs Preference. Which option is better?

I think I don't need to explain in detail about plugins, preferences and observers. These are types of overriding or extending default magento functionality. While overriding any magento core method/...
0 votes
1 answer
357 views

Overriding Magento 2.3 Checkout Cart Control Using Plugin using around but not working

What I am trying to achieve is when a product is added to the cart, the customer will have the option to add a special gift box. As every product has a different gift box and price so to do this what ...
0 votes
2 answers
56 views

how to create aroundplugin for abstractentity?

I have created around plugin for isAttributeValid function for Magento\ImportExport\Model\Import\Entity\AbstractEntity but it is not working. code: <type name="Magento\ImportExport\Model\Import\...
0 votes
2 answers
352 views

product reviews - "around" plugin extend CollectionFactory query to show children reviews

I have looked everywhere for any reviews extension that supported grouped products and could not find any. So trying to hash it out myself. I need the reviews block on a grouped product to also show ...
  • 1,599
0 votes
0 answers
103 views

aroundSavePaymentInformationAndPlaceOrder plugin not working in magento 2

etc/di.xml <?xml version="1.0" encoding="UTF-8"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config....
  • 1,057
0 votes
0 answers
217 views

Magento 2 System Config Plugin

I have created a custom tab in system config and added 1 field Module Enable Yes/No and 1 Dynamic fields which is depends on Module Enable. When Module Enable is set Yes I created various dynamic ...
0 votes
0 answers
36 views

Magento 2 system config Concatenate data to existing field with plugin beforeSave or aroundSave

I have a drop down field containing fruits where I would like to concatenate some data e.G: Using a Plugin save the data like so: Bananas are high in potassium Where are high in potassium is the ...
2 votes
1 answer
252 views

Around Plugins ( Interceptors) in magento can be used to suppress before and after plugin execution?

In around plugin function, if we don't use proceed() then after plugin execution will be suppressed. Is there anyway by which we can suppress before plugin execution?
2 votes
1 answer
747 views

Magento 2 validate the form input using plugin and save the modified data

I am using custom plugin to validate the user input for customer profile. I have created Module Company_Module and create di.xml file in etc to verify the input given by the user: <type name="...
0 votes
2 answers
34 views

Magento 2 describe attrubute property used in Plugin method

I am trying to create a simple module and I can't find the propose of the attribute name and type inside the tag type and plugin in di.xml. can anyone describe attribute name used in plugin? <?...
  • 189
0 votes
1 answer
211 views

Magento 2.2.2 : Redirect not working from plugin

di.xml <type name="Magento\Framework\AppInterface"> <plugin sortOrder="1" name="noroute_redirect" type="Namespace\ModuleName\Plugin\AppInterfacePlugin"/> </type> ...
0 votes
1 answer
102 views

Magento 2 : Swatches not display when use plugin around

I used around plugin to call custom phtml in category list page. It's working proper. But, In configurable product it's hide to display swatches. I upload here my files code. Which function should I ...
0 votes
1 answer
348 views

Redirect from around plugin in Magento 2

How to redirect from around plugin to another page with an error ?
0 votes
1 answer
577 views

Magento : Around Plugin for LoginPost

I would like to write a plugin for Magento\Customer\Controller\Account\LoginPost. Actually I've custom template that is called when customer clicked on Proceed to Checkout. (Only when customer is not ...
  • 3,714
0 votes
1 answer
149 views

Page cache issue, my plugin only works after the first page load

I have created a module that autoselects a currency based on the user's country using a plugin for Magento\Store\Model\Store::getDefaultCurrencyCode() . On the first page load it will show the ...
  • 139
0 votes
3 answers
1k views

Customer redirect issue with plugin method magento2

I have used below code to write plugin method for loginPost controller. this is the code of etc/di.xml <type name="Magento\Customer\Controller\Account\LoginPost"> <plugin name="...
  • 1,819
0 votes
0 answers
312 views

Magento2: Stop user registration email notification to customer programmatically

I want stop email notification for user registration(createuser) programmatically. We can use plugin, observer, extend createpost controller. Can anyone please suggest which way is standard to do ...
  • 1,799
1 vote
0 answers
670 views

Magento 2.1.11 - Interceptor throwing ltrim expects 1 parameter to be string, object given warning exception

I want to make a plugin to do something around a custom made checkout method. I do have other interceptors working prior to adding this, but this one I am getting a ltrim warning. CRITICAL: ...