Hello,
I just upgraded to 2.4.7-p2 to get the new FedEx api working.
Connection works fine but I'm not getting the right prices for our account.
FedEx tells us that we have a wrong param in the request :
"rateRequestType": [ "LIST" ],
Should be
"rateRequestType": [ "PREFERRED" ],
I could not see this option in admin.
Should it not figure there?
I tried to change this directly in vendor/magento/module-fedex/Model/Carrier.php and it seems to do the job.
But I also tried to override the Model to avoid update issues without luck.
Any idea on how I could get this fixed please?
Hello @ShapesGS
To override the Magento\Fedex\Model\Carrier class in a custom module in Magento 2, follow these steps:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Vendor_FedexOverride" setup_version="1.0.0"/> </config>
namespace Vendor\FedexOverride\Model; use Magento\Fedex\Model\Carrier as FedexCarrier; class Carrier extends FedexCarrier { // Override methods here public function collectRates(RateRequest $request) { // Your custom logic $result = parent::collectRates($request); // Modify the $result as needed return $result; } }
<type name="Magento\Fedex\Model\Carrier"> <plugin name="fedex_carrier_override" type="Vendor\FedexOverride\Model\Carrier" /> </type>
Hope it helps !
If you find our reply helpful, please give us kudos.
A Leading Magento Development Agency That Delivers Powerful Results, Innovation, and Secure Digital Transformation.
WebDesk Solution Support Team
Get a Free Quote | | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789
Thank You,
WebDesk Solution Support Team
Get a Free Quote | Email | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789
Location: 150 King St. W. Toronto, ON M5H 1J9