Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,176,090 members, 7,896,629 topics. Date: Sunday, 21 July 2024 at 05:45 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 (787 Views)

Urgently Need Someone To Override Windows 10 Startup / How To Load Product By SKU In Magento 2? / 6 Types Of Products In Magento E-commerce (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)

Want To Learn Python Or Javascript? / Moat Academy In Lag Again! / Mobile App Development Platform❤️

(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 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 4
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.