diff --git a/src/Traits/WebhookController.php b/src/Traits/WebhookController.php index 0ec401cd..3fff8c3a 100644 --- a/src/Traits/WebhookController.php +++ b/src/Traits/WebhookController.php @@ -32,11 +32,20 @@ public function handle(string $type, Request $request): ResponseResponse $jobClass = $config[$type]['class']; } - $jobClass::dispatch( + $dispatch = $jobClass::dispatch( $request->header('x-shopify-shop-domain'), $jobData - )->onConnection(Util::getShopifyConfig('job_connections')['webhooks']) - ->onQueue(Util::getShopifyConfig('job_queues')['webhooks']); + ); + + $connection = Util::getShopifyConfig('job_connections')['webhooks'] ?? null; + if ($connection) { + $dispatch->onConnection($connection); + } + + $queue = Util::getShopifyConfig('job_queues')['webhooks'] ?? null; + if ($queue) { + $dispatch->onQueue($queue); + } return Response::make('', ResponseResponse::HTTP_CREATED); }