Questions tagged [after-plugin]

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

Filter by
Sorted by
Tagged with
2
votes
2answers
330 views

Override Shipping Rates at checkout

I am simply looking to get the shipping rates from the current quote and override them via a plugin/interceptor but have no idea where I'm going wrong here: <?php namespace Vendor\Module\Plugin\...
0
votes
1answer
24 views

Magento 2 - Write plugin for API interface

In the documentation it says: "A plugin, or interceptor, is a class that modifies the behavior of public class functions by intercepting a function call and running code before, after, or around ...
0
votes
1answer
19 views

Plugin for an existing plugin

Is it possible to create a plugin for an existing plugin class in Magento 2.3.5-p2 and if so, are there any special ways of doing this besides the normal plugin creation?
0
votes
1answer
33 views

Execute after plugin: how to know no error occurred?

I'd like to plug an after plugin to the admin controller saving attribute data (Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save) but this plugin should be processed only if no error/...
0
votes
0answers
34 views

Plugin / Interceptor on Customer Custom Attribute (M2)

Is there a way to have a plugin / interceptor on a custom attribute to modify its value regardless of where used on the website? We have an additional attribute on Customers (is_allow) which returns a ...
0
votes
0answers
38 views

How to save custom attribute in quote_item using api / rest

I'm creating a module where I add a new field in the quote_item and order_item table (not necessary in the product). The columns were created, and when I look at the items in the cart, I fear the ...
0
votes
1answer
49 views

How do i get createAccount methods argument in after plugin Magento 2?

I am writing after plugin on create account method, to change the API response with. I have to call createCustomerAccessToken($username, $password) function, which has two parameters. What I am ...
0
votes
0answers
34 views

Magento 2 Plugin on Magento\Store\Model\Store

How to check if a plugin really work? files are: app/code/Vendor/Module/etc/di.xml <?xml version="1.0" encoding="utf-8"?> <config> <type name="Magento\Store\...
0
votes
0answers
19 views

Plugin modifications not getting reflected in orders and adminhtml

I am building a plugin which would build the price of product based on formula (param1+param2+param3) with each parameter being store in database. Files of which are: <MAGENTO-ROOT>/Vendor/...
2
votes
1answer
121 views

Execute Plugin Class from specific module in Magento2

I have created a custom reports using ui components. For the export csv I have created a plugin class for this function. Vendor/Report1//etc/di.xml <type name="Magento\Ui\Model\Export\...
0
votes
0answers
15 views

Extending Error handler using plugin method is not working

I need to save errors in my database. So I am trying to extend Error Handler in my custom module using plugin method. But it is not working. Here is my code di.xml <?xml version="1.0"?> <...
1
vote
1answer
37 views

Magento 2 how to get get product ID in after plugin?

please help, I'm struggling with this. I'm using this plugin public function afterAddProduct($subject, $productInfo, $requestInfo = null) I'm trying to get the product Id of the product in this way:...
0
votes
1answer
47 views

Plugin always breaks the core Flatrate Shipping method

I have created a plugin to customize the Flatrate shipping(per order) when a guest checks out any product. Below are my relevant module-plugin files which I supposedly wrote as per Magento 2.x's ...
0
votes
2answers
81 views

Magento 2.3.4 Plugin Sitemap not working

I've had a plugin working on 2.2.2 version but it's not working on 2.3.4. Its seem that collectSitemapItems() method is not firing even in native magento WHen I print_r('Die');die; public function ...
0
votes
0answers
11 views

I need to check entered shipping adddress post code exists in saved pincode table of db

I want to validate the post code of the shipping page with saved Pincode in my custom table of db. If Postcode exists in table shipping method list should be visible (i.e comes through estimate-...
0
votes
0answers
27 views

Magento 2.2.4 Add Link to NoSuchEntityException error message

I have this file which checks unique mobile no in the customer registration page and throws error if the mobile no entered is already in use <?php namespace Vendor\Module\Model\Attribute\...
0
votes
1answer
77 views

Plugin to change order status after payment capture

Currently Magento2 sets the order status to the default status of the state STATE_PROCESSING when a credit card payment is captured. This is done in vendor/magento/module-sales/Model/Order/Payment/...
3
votes
0answers
43 views

Plugin to alter custom attribute value

To alter product price before displaying on frontend we can use Plugin afterGetPrice() same for Name afterGetName and so on for default product attributes. Is there any way to perform same for any ...
2
votes
1answer
51 views

Cart page fatal error after creating a product collection plugin, Magento 2.3

We have a need to sometimes fetch product prices from an API for products loaded on the frontend. We figured it would be easiest to create a plugin for the collection: <?xml version="1.0"?> <...
0
votes
2answers
35 views

Resourcemodel plugin not working - Magento2

app/code/Mymodule/Orderedproductsreport/etc/di.xml <type name="Magento\Reports\Model\ResourceModel\Product\Sold\Collection"> <plugin disabled="false" name="...
0
votes
0answers
471 views

Magento 2 - How to call parent function inside the plugin

I have created the plugin for a particular function. That function is also calling another protected function of the core file. public function afterPopulateTaxRateData( \Magento\Tax\Model\...
2
votes
1answer
432 views

Magento 2 REST API: Get the name of child products in bundle_product_options-> product_links

So I am trying to go for a headless magento approach. I am using the following API to get product details: V1/products/:sku If the product is a bundle product, it shows bundle_product_options in ...
0
votes
2answers
95 views

Magento 2 - Create a log file in plugin that will print log when data is inserted in database

I have entered data in the database using object Manager in Model file itself. I want to print a log file from the plugin that will print the log of the last data that is inserted in the database.
1
vote
0answers
234 views

How to extend store credit functionality in Magento 2 Enterprise Edition

I want to add amount as store credit by: -> API -> Using Payment Method By default store credit is added when we redeem gift card. But my requirement is to add store credit directly by customer ...
2
votes
1answer
77 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?
1
vote
2answers
38 views

Can I access changed parameters in an after/around plugin?

I want to access a parameter of a method in an after plugin. The value of the parameter has been changed inside the original method, and I want to access the modified value. Example: class ...
0
votes
1answer
407 views

Get Product info from afterAddProduct Plugin in magento 2

I have a custom functionality for add to cart in product detail page. Once button clicked, sending product id and adding product to the cart. Used below code to implement it. <input type="hidden"...
1
vote
1answer
34 views

I cant seem to write an Plugin for \Magento\ImportExport\Model\Import\AbstractSource

I am trying to write a plugin for \Magento\ImportExport\Model\Import\AbstractSource::current using <type name="Magento\ImportExport\Model\Import\AbstractSource"> <plugin name="...
0
votes
1answer
40 views

Plugin method not found

This is my plugin: <?php namespace Vendor\Module\Plugin; use Magento\Email\Controller\Adminhtml\Email\Template\DefaultTemplate; class MyPlugin { public function afterExecute(DefaultTemplate $...
1
vote
1answer
99 views

Unable to get newly inserted Product's Id using After Plugin for Catalog Product save controller method

I have created interceptor for catalog product controller's save action <type name="Magento\Catalog\Controller\Adminhtml\Product\Save"> <plugin name="ricky_catalog_save_product" ...
1
vote
1answer
894 views

Magento 2.3.0 How to override wishlist & compare product list page using plugin

I want to override wishlist & compare product grid using plugin. after that i would like to append custom div under class="product-image-container". I try & search a lot but no luck. is there ...
0
votes
0answers
561 views

Customer redirect issue with login post plugin magento2

I have used two plugins to use the referral url's for customer login page. here is the code of my etc/di.xml <type name="Magento\Customer\Controller\Account\LoginPost"> <plugin ...
0
votes
0answers
112 views

How to get popup on button click via plugin at admin side in Magento 2

I have "New Add Product" button at Sales->Order->Create New Order which I added through plugin. My di is at: etc/adminhtml As <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
1
vote
0answers
61 views

How to insert a text into before all magento notification messages in magento 2 with plugin?

I'm new Magento. Can someone tell me how to insert a text into before all system messages of Magento 2 with a plugin. When I do anything, I get the message.Ex :login, create account, add to cart,...
1
vote
0answers
49 views

Magento2 Plugin for beforeExceute that return a $resultRedirect->setPath('customer/account/login');

I've to "override" a module that manage a redirect. The original module have this code: public function execute() { [...] $resultRedirect = $this->resultFactory->...
2
votes
1answer
74 views

Magento2: Intercept category moved inside tree

I am trying to intercept when a category is moved inside the category tree. At the beginning I thought to observe the event catalog_category_tree_move_after with an Observer class but I found that ...
0
votes
2answers
197 views

Plugin isn't working in Magento2 local host

My very basic plugin is not working and i can't understand why. I'm very new to Magento 2 so it's probably something simple. The Plugin is suppose to display "Too expensive" or "too cheap" on all ...
4
votes
2answers
128 views

Magento 2 Plugin Not Extending Model - Finally Solved It

I'm trying to use a plugin from the answer on this question Add additional select attributes to grouped product's child collection I would go back and ask the person who answered but I don't ...
2
votes
1answer
516 views

Argument passing error in after plugin

I am trying to create after plugin for delete function of Magento\Tax\Model\TaxRuleRepository function looks like follows public function delete(TaxRuleInterface $rule) { $ruleId = $rule-...