Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Make your voice heard. Take the 2019 Developer Survey now

Questions tagged [plugin]

Denotes questions about Magento 2 Plugins (BeforePlugin , AfterPlugin and AroundPlugin).

0
votes
0answers
5 views

After Plugin does not run at checkout

Recently I create two after plugins, one that point to Magento\Catalog\Pricing\Price\FinalPrice::getValue() and other that point to Magento\Catalog\Model\Product::getPrice() and Magento\Catalog\Model\...
0
votes
1answer
22 views

Adding custom layout handle for layouts (1 column, 2column etc) set via product admin page

I want separate layout handles defined for products dependent on their layout set via the layout options for product within admin (1 column, 2 column left, 2 column right). I need to set additional ...
1
vote
0answers
24 views

Magento 2 - CMS Specific page_layout XML and Dedicated page_layouts in general?

I'm looking for some BEST PRACTICES insight into using page_layout.xml. Is it a good idea to try and decouple the non-shared resources on Product Pages, Category Pages and CMS Pages? If so, what's the ...
0
votes
1answer
24 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
1answer
17 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
1answer
21 views

skip function execution using before plugin

I'm overriding the controller Magento\User\Controller\Adminhtml\User\Validate::execute() using before-plugin so I can perform some checks before magento validate using this function. If certain ...
0
votes
1answer
25 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
1answer
52 views

Magento 2 plugin change price of products that have a custom attribute with

I'm trying to change the prices of products with a plugin. And it works, basically. The problem is this: i only need to change the price of products that have a specific attribute, not the price of ...
1
vote
1answer
33 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.
0
votes
1answer
18 views

Redirect from around plugin in Magento 2

How to redirect from around plugin to another page with an error ?
0
votes
0answers
13 views

How to get Image data in Magento\Quote\Api\CartTotalRepositoryInterface using extension_attributes?

GET V1/carts/mine/totals This API Returns information for the cart totals a specified customer. How to get Item Images using extension_attributes on get function of Magento\Quote\Api\...
6
votes
1answer
174 views

Magento 2 : How to reload minicart from Plugin?

I've written plugin for Magento\Checkout\Controller\Cart::Delete Plugin works great and removed my desirable product from cart. As much as I know Minicart is render with local storage. So that we ...
0
votes
0answers
28 views

Customer Custom Attribute gets deleted upon update in Magento 2

We are facing an issue while updating customer information from Customer My account section on frontend that is Customer Custom attributes gets deleted upon update or save customer information. For ...
1
vote
1answer
40 views

Magento 2 get custom attribute of a single product inside a plugin

Hello Everyone :) I'm in a bit of an empasse now: I'm building a module to edit the price of products that have a custom attribute by multiplying their weight by a variable. Now, almost everything ...
0
votes
0answers
21 views

How to load vendor files in custom extension

Im making a custom extension - how do I load custom vendor files ? Do I add them to my extension composer file or the global Magento one ? I asking because I cant load Yaml. In my extension ...
1
vote
1answer
53 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 ...
0
votes
0answers
11 views

Magento 2. Custom text in place of Price is not working Properly

In custom module I hide the Price and in the place of Price I tried to show Custom text it work perfectly but in some Categories it shows the custom text twice e.g men, Women. I can show the details ...
0
votes
0answers
11 views

Project results change event in JS

In Javascript or Jquery is there an event that can be watched to see if the product results set has been changed or filtered because sometimes the window does not reload and my plugin login does not ...
2
votes
0answers
26 views

Magento 2. how to hide price only for specific categories

Actually I hide the price using Plugin but now I want to hide price only for specific categories like I only want to hide the Price for bags. I want to do this thing by using Admin configuration like ...
2
votes
0answers
24 views

Replacing string in checkout summary

We have managed to modify the " Talla" Field in order to remove the "(-)" part. What happens is once we go to next, once selected the address we want to send to, it reloads the page and the "(-)" ...
0
votes
1answer
28 views

Magento CE 2.2.2: How to add images to my custom payment plugin module?

I am creating a custom payment plugin for Magento 2.2.2 For the plugin I need to add the payment icons and some other images. How can I add images for my custom payment plugin? I tried all the ...
2
votes
1answer
64 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:...
3
votes
0answers
58 views

Magento 2 Plugin Sort Order

I am trying to understand the concept of sort order when using plugin. As per my understanding the sort order works in lower to higher when used before method and higher to lower when used in after ...
0
votes
1answer
43 views

Plugin class Magento\NewRelicReporting\Plugin\StatePlugin doesn't exist

I just update my Magento 2.2 core components using the command composer update -vvvv and then I got a lot of updates which caused this issue below when I tried to run php bin/magento setup:upgrade. ...
0
votes
0answers
18 views

How to access data in the function that I am observing?

I created a plugin for Iways\PayPalPlus\Controller\Order\Create.php This is the function that I am observing. public function execute() { try { $cartId = $this->checkoutSession->...
0
votes
1answer
43 views

Country drop down is empty magento2

I have set default country as UK in admin, after the configuration is done, In checkout one empty drop down is showing before the UK country. so I have used below plugin to remove that empty dropdown....
1
vote
0answers
15 views

Magento 2 | How to put Button in Guest user Order and Account Information Page?

I need to edit email address of Guest Customer. As form the picture: I know it should be done by plugin but I want to know What is the right way to find right method to override for putting button ...
2
votes
0answers
28 views

Custom plugin files updated code is not showing in admin panel though cache is cleared

I have created a custom module. Controller files are working fine. I am trying to update my module MySQL version and adding new fields to the module in block folder files but they are not applying in ...
1
vote
1answer
52 views

How to enable a shipping method for a specific SKU?

I'd like to create a module to enable the Table Rate Shipping Method if a product with a specific SKU is the customer cart. How could I do that?
0
votes
0answers
33 views

Update programmatically config content text/x-magento-init script inside of phtml template

For a requirement I had to override the config of the configurable.js script that is initialised inside configurable.phtml, this one specifically: <script type="text/x-magento-init"> { ...
0
votes
2answers
48 views

Plugin not triggering while placing order

I am creating a plugin for Quotemanagement (placeOrder) with after method, but some reason it’s not triggering. I try with die but no luck Please help, I am using Magento 2.2.6 Here is my code ...
0
votes
2answers
70 views

How to create plugin for observer Magento 2?

I have one Observer in my custom module. I want to create Plugin for that observer. How can I achieve that ?
1
vote
2answers
44 views

how to use plugin/other module for add html for other module in magento 2?

I want to render html (Front-side) using plugin/other module in different module. There's already existing form in Module X. I want add one drop-down in that from using Module Y. How can i achieve ...
2
votes
3answers
59 views

How can we get stock data in product listing via afterGetList plugin in Magento 2.2.3

Since magento 2.2.3 is displaying out of stock items in product listing, I would like to get the qty attribute in the listing using rest API. I'm using afterGetList plugin. di.xml <type name="...
0
votes
0answers
15 views

Magento 2 : LayeredNavigation plugin never called

I'm trying to override the function canShowBlock() in the Magento\LayeredNavigation\Block\Navigation block. I'm using this plugin but it's never called : di.xml <?xml version="1.0"?> <...
0
votes
0answers
22 views

Adding columns to order list page breaks order view tabs

I'm trying to made a custom module (custom collection or plugins both will break the order view's tab) to add a column order list view di.xml <?xml version="1.0"?> <config xmlns:xsi="http://...
1
vote
3answers
94 views

Magento 2.2.5: How to get product id after product saved using plugin

I'm looking for how to get product id after product saved using plugin. I use the plugin to catch after execute() is fired. But I can't get product id no matter how I try. Here is what I've done: ...
1
vote
4answers
66 views

How do you create a zip file after developing the module?

I have been developing WordPress plugin since more than 5 years. Since all files in WP plugin in one folder, it is very easy to create a zip file. But it is very different in Magento. After I finish ...
0
votes
0answers
23 views

Filter menu item collection dynamically

I'm looking for a way to filter the collection of catalog menu items that is used to render the menu. For some customers I want to hide one or more categories. I have the CategoryId's of those ...
0
votes
0answers
44 views

Why customer got logged out when saving customer info on Login Plugin/Interceptor?

I'm experiencing a problem when using Magento\Customer\Api\CustomerRepositoryInterface to save customer group. Here is my code in app/code/Vendor/Module/etc/di.xml: <?xml version="1.0" encoding="...
1
vote
0answers
52 views

How to update success/error message using PLUGIN in Magento 2?

I have already checked this link and found it working, but in this thread, the observer is used to change the success/error message. I want to know whether it is possible to change/update the success/...
1
vote
0answers
27 views

How to change Product Listing Sort by custom select option? [closed]

In my module, I have created a select option with attributes. When I select an attribute, that attribute will be set to sort by default. How can I do that. I found Magento\Catalogfile\Block\Product\...
0
votes
1answer
24 views

Magento 2 marketplace submission issue

I have update one my extension to the marketplace. But I am getting error “Class doesn't exist” error but my class is already there. My di.xml is below. <type name="Magento\Framework\View\Result\...
0
votes
0answers
42 views

Change product image issue in Minicart Magento2

I am trying to change product image in minicart, Used below code to achieve it. here is the code of my di.xml file. <type name="Magento\Checkout\CustomerData\AbstractItem"> <plugin name="...
1
vote
0answers
47 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=...
2
votes
1answer
74 views

How to create plugin to override a magento2 module?

I can not override a protected function using plugin. iS there any other way to override the same function?
0
votes
1answer
21 views

List of files those are updated in upgrade Magento 2.2.x1 to 2.2.x2

I need to list all the files which are modified as we upgrade Magento 2.2.x1 to 2.2.x2.So that I can figure out the rewrites and the other plugins which I have made are working properly after the ...
2
votes
0answers
28 views

Magento 2 Block Payment and Order

I am trying to write a plugin that will block a payment and place order based on a condition. I have this: Vendor/Module/etc/di.xml <?xml version="1.0" encoding="UTF-8"?> <...
5
votes
1answer
46 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" ...
0
votes
1answer
88 views

Exception: Warning: Illegal offset type in Module/Modulename/Plugin/StoreRepositoryPlugin.php

Exception: Warning: Illegal offset type in Module/ModuleName/Plugin/StoreRepositoryPlugin.php Getting above error at this line: if ($this->entitiesById[$id]) { I'm trying to override "vendor\...