Questions tagged [preference]
Denotes questions related to Magento 2 preferences
103 questions
3 votes
0 answers
79 views
override private function not working - Magento\InventoryLowQuantityNotification
This seemingly simple override via preference just isn't happening and I'm not seeing what's wrong. I just want it to use a different version of addSourceItemInStockFilter() PS: I have verified that ...
0 votes
1 answer
79 views
Minimal Dependency Injection Preference Example
I am trying to change the logic in my Elasticsearch engine from "and" logic to "or" logic following the advise of the second answer in this question How do I change Magento 2 ...
1 vote
2 answers
582 views
Magento 2 how to overwrite a trait function
How do you overwrite a trait function from vendor. Things i did try in the di.xml <preference for="\Vendor\Module\Traits\Model\ChangeMe" type="\Company\Module\Traits\...
1 vote
2 answers
370 views
How to override CartItemInterface class in in my custom model?
I have to add 2 new methods getter and setter in CartItemInterface but i am facing issues. Basically I have added a new column in quote item table and now I want to add this column in cart api. Please ...
0 votes
1 answer
246 views
Override CatalogWidget\Block\Product\ProductsList with new dependence injection
Here is my di.xml <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <...
0 votes
1 answer
656 views
Override \Magento\CatalogImportExport\Model\Import\Uploader.php
I'm working on 2.4.5 upgrade and Magento has a bug in the core. I need to work around the bug by overriding a class. I created a plugin to override it via preference. What am I missing? /etc/di.xml &...
0 votes
1 answer
254 views
Whenever a product is added to cart an additional qty of same product should be added to cart using prefrence not plugin? [duplicate]
Should be achieved by preference not using the plugin and observer. can anyone provide code for this ?
0 votes
1 answer
1k views
How to override the Search.php using preference in magento 2?
I am not able to override the Search.php file by using preference in magento 2.3.4. Below is the my di.xml file. Please anybody can check the below code. <config xmlns:xsi="http://www.w3.org/...