-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Labels
Fixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedimprovement
Description
Summary (*)
Flat Rate
, Free Shipping
, and Store Pickup
shipping methods use protected $_code variable to provide information about carrier's code.
For example, Flat Rate
shipping method:
class Flatrate extends AbstractCarrier implements CarrierInterface
{
/**
* @var string
*/
protected $_code = 'flatrate';
...
In the getAllowedMethods()
function for this shipping method we have:
* @return array
*/
public function getAllowedMethods()
{
return ['flatrate' => $this->getConfigData('name')];
}
So, carrier's code is duplicated.
Examples (*)
Proposed solution
Use $this->_code
in the getAllowedMethods()
function of Flat Rate
, Free Shipping
, and Store Pickup
.
For example, a code optimization for Flat Rate
will look like:
/**
* @return array
*/
public function getAllowedMethods()
{
return [$this->_code => $this->getConfigData('name')];
}
Metadata
Metadata
Assignees
Labels
Fixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedimprovement