Skip to content

Instantly share code, notes, and snippets.

@reense
Last active July 12, 2021 08:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reense/0b0bf0d50620d2e73a349856a23d1e6e to your computer and use it in GitHub Desktop.
Save reense/0b0bf0d50620d2e73a349856a23d1e6e to your computer and use it in GitHub Desktop.
Patch for magento/magento2 issue 32916.
From 1274e9c6cb5ce5109db658f1d40bb27e6c1f7a08 Mon Sep 17 00:00:00 2001
From: Reense <reense@tickles.nl>
Date: Mon, 12 Jul 2021 10:23:31 +0200
Subject: [PATCH] Fixex undefined indexes in ShippingMethod source.
---
Model/Source/ShippingMethod.php | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Model/Source/ShippingMethod.php b/Model/Source/ShippingMethod.php
index 77e5390..19c5c7e 100644
--- a/Model/Source/ShippingMethod.php
+++ b/Model/Source/ShippingMethod.php
@@ -45,9 +45,10 @@ class ShippingMethod implements OptionSourceInterface
$carriers = $this->scopeConfig->getValue('carriers');
foreach ($carriers as $carrierCode => $carrier) {
- $shippingTitle = $carrier['title'];
+ $shippingTitle = $carrier['title'] ?? $carrierCode;
+ $active = $carrier['active'] ?? false;
- if (!$carrier['active']) {
+ if (!$active) {
$shippingTitle .= __(' (disabled)');
}
--
2.30.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment