Skip to main content

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
3 votes
3 answers
6k views

Is dependency injection possible for plugins?

I'm trying to make a plugin to extend the \Magento\SalesRule\Model\Validator Which works like a charm, but the problem is I need to make use of Magento\SalesRule\Model\RuleFactory I've tried making ...
marijnm's user avatar
  • 67
2 votes
1 answer
779 views

Magento 2: Purpose of "Public Cookie Meta Data"

In the shipping version of Magento 2, there's an afterDispatch plugin on the front controller #File: vendor/magento/module-page-cache/Model/App/FrontController/MessageBox.php public function ...
Alana Storm's user avatar
  • 44.4k
3 votes
1 answer
7k views

How to Override or Extend protected or parent function in Magento 2 using Plugin

I need to override protected function or parent function ex Magento\Checkout\Controller\Cart\Add is extended from Magento\Checkout\Controller\Cart and getBackUrl() is a Magento\Checkout\Controller\...
Pradeep Kumar's user avatar
0 votes
2 answers
578 views

Magento 2 fail to add a plugin to the Model class - Customer.php

I wrote a plugin to Customer.php, for testing purpose, I added the error_log statement, but it had not been executed when I do the login action. Customer.php in my plugin: <?php namespace Vendor\...
Ricky.C's user avatar
  • 2,182
2 votes
3 answers
3k views

Overwriting the Magento\Checkout\Controller\Cart\Add::getBackUrl with Plugin

I've been trying to overwrite the getBackUrl method in the Cart Add controller of the checkout. With a preference I managed without an issue but plugins are a bit more of a challenge. Here's what I ...
Sander Mangel's user avatar
1 vote
0 answers
43 views

Separate login pages from general pages

On my website I have homepage, Page 1, Page 2 and Page 3. Now there are subpages in Page 1 and Page 2 which I want visitors to first login (by site registration or through social media account)and ...
Pravin Wagh's user avatar
1 vote
0 answers
54 views

Cached Layout file?

I have an issue, that i want to load an layout from a 3rd party module on a page in my module. I don't load the dependent layout explicitly, i just load my own: <layout> <updates> ...
sebastian's user avatar
  • 253
0 votes
1 answer
121 views

Can publish a plugin in magento connect, which developed for my own website

I have been working on a project built on cake PHP. The project is an multivendor eCommerce platform. The client for which I am building this application ,wants to create a magento plugin. This ...
Ramesh Dahiya's user avatar
51 votes
3 answers
20k views

Magento2: what is the basic difference between plugin and preference?

I used both Plugin and Preference in Magento2 tutorial and both are working fine but what is the basic difference between them. Code for plugin: 1.1) Add a plugin declaration into di.xml: <type ...
Yogesh Karodiya's user avatar
3 votes
1 answer
4k views

Plugins not called in magento 2

I have created a plugin in my custom module to override the default method getName() in Magento\Catalog\Model\Product.php I've created my custom module named Firstmodule inside app\code\Magento. I ...
Manashvi Birla's user avatar
14 votes
2 answers
1k views

Magento 2: Consequences of not Naming a plugin class `\Plugin`

Are there any consequences for using a plugin class in Magento 2 that doesn't end in \Plugin? The docs suggest that this class should end in the name \Plugin. The name of a plug-in’s class or its ...
Alana Storm's user avatar
  • 44.4k
0 votes
2 answers
2k views

How to set Ogone Ingenico after payment back urls? [closed]

I've an existing Magento ecommerce and I've to manage some operations in the final part of the payment process, exactly in the script redirected after the payment done through the Ogone Ingenico ...
axel's user avatar
  • 101
0 votes
1 answer
92 views

Plugin to request combined shipping rate before processing payment

I'm looking for a plugin where the buyer can add all of the items into their cart and request a manual combined shipping rate before processing their payment. I need to be able to manually adjust the ...
yoitslo's user avatar
2 votes
0 answers
16 views

Adding an optional cost after choosing a shipping method [duplicate]

I'm trying to add an optional cost after the customer choose the GLS shipping method: he can choose to be notified by SMS about the status of his order paying a fixed cost. There's an existing plugin ...
Marco Piazza's user avatar
19 votes
3 answers
2k views

What Classes are "Intercept-able/Plugin-able" in Magento 2

Date: May 30, 2015 (given the changing nature of Magento 2). Magento 2 introduced a plugin concept, implemented via an interceptor pattern. What's not clear from the docs is -- which classes and ...
Alana Storm's user avatar
  • 44.4k
0 votes
1 answer
260 views

Magento2 use Plugins (di.xml)

I have created a Plugin. Registered it in di.xml All public methods execute. Can I inject/rewrite/replace (don't know the proper title) protected methods? How?
zhartaunik's user avatar
  • 3,846
30 votes
5 answers
8k views

Learning Magento Plugin Development

I have been a PHP developer for 13+ years, have extensive knowledge of PHP itself as long as some other popular projects like WordPress. I have no experience with Magento. I now have a full time job ...
JasonDavis's user avatar
  • 1,073

1
9 10 11 12
13