Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 2,906,363 members, 7,006,661 topics. Date: Monday, 08 August 2022 at 05:43 PM

How To Override A Core Class In Magento 2 - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / How To Override A Core Class In Magento 2 (701 Views)

Looking For A Core PhP and Mysqli Developer? / Urgently Need Someone To Override Windows 10 Startup / Has Anybody Attended Soutech Ceh Class In Lagos (2) (3) (4)

(1) (Reply)

How To Override A Core Class In Magento 2 by Anthonynguyen(m): 3:43am On Jul 20, 2019
When you need to override a core class in Magento 2, you can handle this by using Preference or Plugin.


In Magento 2, Preference extends a core class. It can rewrite function. When you declare a Preference, your new class is expected to be a complete implementation of the class you want to override.

While a plugin allows you to execute your functions before, after or around (before & after) the core function is executed. It's NOT really rewritten function like Preference.

For more information: https://store.magenest.com/blog/how-to-override-core-class-magento-2/

(1) (Reply)

Please Read This / check out / Who Can Help Out With This Python Problem?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2022 Oluwaseun Osewa. All rights reserved. See How To Advertise. 21
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.