I would need to hide SHIPPER_ACCOUNT_NUMBER on FedEx shipping label. FedEx support told me I had to set this in the module, that their API is able to hide some elements.

They gave me :


But I can't find which file I have to edit.

I found







<xs:simpleType name="LabelMaskableDataType">
        <xs:documentation>Names for data elements / areas which may be suppressed from printing on labels.</xs:documentation>
    <xs:restriction base="xs:string">
        <xs:enumeration value="CUSTOMS_VALUE"/>
        <xs:enumeration value="DUTIES_AND_TAXES_PAYOR_ACCOUNT_NUMBER"/>
        <xs:enumeration value="SHIPPER_ACCOUNT_NUMBER"/>
        <xs:enumeration value="TERMS_AND_CONDITIONS"/>

So module should be able to hide this also, but I did not find any options in administration.

I would also like to have this as an override if possible, so that I could update Magento without having to write a hack every time.

Any help would be appreciated

1 Answer 1


The method currently building the request is Magento\Fedex\Model\Carrier::_formShipmentRequest. You'll likely need to insert a preference for the Carrier class because the method you need to update and it's sole caller, Magento\Fedex\Model\Carrier::_doShipmentRequest, are protected. Drop code similar to the examples below in a custom module and any new shipping labels create should have the data masked. This will not update existing labels since the label is created and stored with the shipment data when it is created.



namespace Vendor\Module\Model\Fedex;

class Carrier extends \Magento\Fedex\Model\Carrier
    protected function _formShipmentRequest(
        \Magento\Framework\DataObject $request
    ) {
        $result = parent::_formShipmentRequest($request);

        if (!isset($result['RequestedShipment']['LabelSpecification'])) {
            return $result;

        $result['RequestedShipment']['LabelSpecification']['CustomerSpecifiedDetail']['MaskedData'] = [

        return $result;


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Fedex\Model\Carrier" type="Vendor\Module\Model\Fedex\Carrier" />
  • Thanks for the answer and the effort, I added the module, and will get back to you on next orders to tell you how it's working.
    – David
    Sep 27, 2017 at 13:41
  • It seems like the shipping can not be created anymore after the adding of the module.
    – David
    Sep 28, 2017 at 10:00
  • Sorry my bad, I was also working in parallel on the adding of tax_amount column for orders and invoice grids, and it appears it was blocking the shipping label creation.. Magento dev can be so pernickety sometimes.. Your solution works great, thanks a lot !!!
    – David
    Sep 28, 2017 at 14:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.