diff --git a/Model/Carrier/BobGo.php b/Model/Carrier/BobGo.php index 1260bbfd8508776e36eb0c735a41770cbac89e93..d269be10d69d3b406fd4412d28b3a3e6f0fbad17 100644 --- a/Model/Carrier/BobGo.php +++ b/Model/Carrier/BobGo.php @@ -1066,6 +1066,11 @@ class BobGo extends AbstractCarrierOnline implements \Magento\Shipping\Model\Car \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); + // Check if the webhook key is empty and return false + if (empty($webhookKey)) { + return false; + } + // Convert the string to a boolean value $isEnabled = $this->isWebhookEnabled(); diff --git a/Observer/OrderWebhookBase.php b/Observer/OrderWebhookBase.php index 62988c46be67f0066d8724530b3028040fa9c117..311daa7b64f0d512d79bf94f2e6af3f894a3deac 100644 --- a/Observer/OrderWebhookBase.php +++ b/Observer/OrderWebhookBase.php @@ -52,6 +52,11 @@ abstract class OrderWebhookBase implements ObserverInterface // Generate the signature using the webhook key saved in config $webhookKey = $this->scopeConfig->getValue('carriers/bobgo/webhook_key', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); + // Check if the webhook key is empty and return false + if (empty($webhookKey)) { + return; + } + // Send the webhook $this->bobGo->encodeWebhookAndPostRequest($url, $data, $storeId, $webhookKey); }