Questions tagged [before-plugin]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
23 views

Plugin beforeGetUrl - not being used? (solved, facepalm)

I have grouped products "containing" simple products. I have had to make the simple products visible but while I am ok for them to appear in certain lists, I want the link to go to the parent page not ...
0
votes
1answer
81 views

Magento 2: Get the qty of products before added to cart

I'm trying to get the qty of products in a plugin with a method called beforeAddProduct, with this method I can manipulate things before being added to cart. I need to check that the qty added to ...
0
votes
2answers
47 views

Magento 2 plugins (interceptor) beforeCancel() making the cancel order bug

I have created a plugin which intercept the cancel function from the interface Magento\Sales\Api\OrderManagementInterface, the plugin intercept before the cancel function is called. My problem is ...
1
vote
1answer
69 views

Magento 2 how to restrict add wish list a product

I would like to stop adding products to the wishlist based on the product attribute how to do that? I would like to use the plugin concept instead of overriding the entire controller file. Magento\...
0
votes
1answer
38 views

Magento 2.2.2 Plugin how to add custom field in request api

I've create a plugin to listen to api POST /V1/order/:orderId/refund and I would like to receive custom field. I've added a field for testing like: name:['test'] Body E.G: { "items": [ ...
2
votes
1answer
201 views

Plugin intercept before place order for PayPal method on Magento2

In my Magento2 instance, I created a Plugin interceptor for run custom validation before process the payment. Works for all payment methods but PayPal Express or PayPal Standard. di.xml <config ...
1
vote
0answers
46 views

Magento 2.2.2 order refund REST API Before Plugin get item order to refund

Vendor\Module\Plugin\Order\Plugin.php: namespace Vendor\Module\Plugin\Order; class Refund { /** * Create refund for invoice * * @param int $invoiceId * @param \Magento\Sales\...
2
votes
1answer
322 views

Magento 2 how to use elasticsearch for custom indexer? Custom sort stops working after enabling elasticsearch

I am a magento newbie and trying to implementing a custom sort on product listing page with the help of this: https://magento.stackexchange.com/a/230983/84727 On top of the solution i have built a ...
0
votes
1answer
85 views

Magento 2.3 customer beforeAuthenticate plugin not working

I am facing allowed memory size of bytes exhausted when ever trying to login customer in magento 2.3.2 I have used beforeAuthenticate plugin to do some functionality after sometime customer can not ...
2
votes
2answers
258 views

Throwing exception based on condition in before plugin

I'm creating a before plugin for the class \Magento\Customer\Controller\Account\EditPost. In the execute method I want to throw an Exception based on certain condition but the plugin is showing output ...
0
votes
0answers
27 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 ...
1
vote
3answers
414 views

Order beforeSave plugin throws TypeError

I've built a plugin that catches the order beforeSave event in order to add some extra data to the an order attribute. The problem is that when this plugin fires it causes an error: Uncaught ...
5
votes
1answer
453 views

Magento 2 :How to change or update request data using beforeExecute plugin?

i just want to change some request params by using beforeExecute plugin so can i do same.... ? etc/di.xml ** <type name="Magento\Customer\Controller\Account\CreatePassword"> <plugin ...
2
votes
1answer
67 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
1answer
47 views

get Coupon Code in beforePlaceOrder

Hello I want to get the coupon code in a plugin. My code is: private $logger; private $checkoutSession; public function __construct( \Psr\Log\LoggerInterface $logger, \Magento\Checkout\...
2
votes
1answer
96 views

how to save product name dynamically

for example i have 3 product attributes color ,size ,location. i do not want to enter product name instead of it should save combination of color,size,location. product name. 'red color small in new ...
0
votes
0answers
806 views

before plugin parameter magento 2

I am writing a before plugin for below public method. public function setup($user,$pass,$url = null){ $this->username = $user; $this->password = $pass; if ($url) { ...
0
votes
1answer
243 views

Observer or plugin use before the invoice creation

I have create custom attribute("current_seller_id") in sales_invoice_item and now want to save some value in this column how can i do this. Actually i already save the value in sale_order_item table ...
1
vote
0answers
187 views

Magento 2:"TypeError: Argument 1 passed to Test\HelloMagento\Plugin\ExamplePlugin::beforeSetTitle()

di.xml <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> <type ...
4
votes
1answer
739 views

On what basis we need to pass the plugin parameters?how we know what should be pass?what's logic behind it?

My requirement is here:- I have a Game booking requirement in Magento 2, just like online movie booking(e.g- booking movie from Bookmyshow, Paytm etc). there is fix number of tickets in each slot ...
1
vote
2answers
664 views

Plugin Before Onepage Dispatch

I have the following plugin: <?php namespace Company\Module\Plugin; class DisableLoginCheckout { /** * @var \Magento\Customer\Model\Session */ protected $customerSession; /*...
0
votes
1answer
65 views

Before plugin for Submit query method

I am trying to create before plugin for SubmitQuote method of Magento\Quote\Model\QuoteManagement but plugin is not hitting. Its a api req so i have declared the plugin in /etc/webapi_rest/di.xml. ...