From c9b2b54e20a656864795c37ec2eab635219cc6d5 Mon Sep 17 00:00:00 2001 From: Brad Bell Date: Sun, 1 Dec 2024 18:47:55 -0800 Subject: [PATCH] Fix #1556 --- CHANGELOG.md | 4 ++++ src/elements/CommerceProduct.php | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35c3237d..51905502 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Release Notes for Feed Me +## Unreleased + +- Fixed a PHP error that could occur if you did not have Commerce installed when running a feed. ([#1556](https://github.com/craftcms/feed-me/issues/1556)) + ## 6.6.0 - 2024-11-26 - Added the `assetDownloadGuzzle` config setting which defaults to `false`. When it is set to `true`, Feed Me will use Guzzle to download assets instead curl directly. ([#1549](https://github.com/craftcms/feed-me/pull/1549)) diff --git a/src/elements/CommerceProduct.php b/src/elements/CommerceProduct.php index a75422b4..52466c95 100644 --- a/src/elements/CommerceProduct.php +++ b/src/elements/CommerceProduct.php @@ -145,8 +145,9 @@ public function init(): void // After the feed has run, create a catalog pricing job to update the pricing Event::on(Process::class, Process::EVENT_AFTER_PROCESS_FEED, function(FeedProcessEvent $event) { - $this->_runCatalogPricingJob = true; - Commerce::getInstance()->getCatalogPricing()->createCatalogPricingJob(); + if (Craft::$app->getPlugins()->isPluginEnabled('commerce') && $this->_runCatalogPricingJob = true) { + Commerce::getInstance()->getCatalogPricing()->createCatalogPricingJob(); + } }); }