Hello,
Are there add-ons/modules to do scheduled price updates for Magento Community Edition open source? I'm only seeing options for the Adobe Commerce option.
Thanks.
Hi @johnspence0bbf ,
Unfortunately, Scheduled price updates facility not available in open source.
Hope it helps!
Thanks
Hello @johnspence0bbf
You can use the below code it worked for me. I used it on the Console commad as it will run in a cron job.
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $state = $objectManager->get('\Magento\Framework\App\State'); $productRepository = $objectManager->get('\Magento\Catalog\Api\ProductRepositoryInterface'); $versionManager = $objectManager->get('\Magento\Staging\Model\VersionManager'); $productStaging = $objectManager->get('\Magento\CatalogStaging\Api\ProductStagingInterface'); $updateRepository = $objectManager->get('\Magento\Staging\Api\UpdateRepositoryInterface'); $updateFactory = $objectManager->get('\Magento\Staging\Api\Data\UpdateInterface'); $timezone = $objectManager->get('\Magento\Framework\Stdlib\DateTime\Timezone'); $storeManger = $objectManager->get('\Magento\Store\Model\StoreManagerInterface'); $storeId = $storeManger->getStore()->getId(); $timezonefill = $timezone->getConfigTimezone(\Magento\Store\Model\ScopeInterface::SCOPE_STORES, $storeId); $currentDate = new \DateTime('now', new \DateTimeZone($timezonefill)); $date = $currentDate->format("Y-m-d"); $state->setAreaCode('frontend'); /** @var \Magento\Staging\Api\Data\UpdateInterface $schedule */ $schedule = $updateFactory; $schedule->setName("Price Update #"); $schedule->setStartTime("2020-06-22 00:00:00"); $schedule->setEndTime("2020-07-23 23:59:59"); $stagingRepo = $updateRepository->save($schedule); $versionManager->setCurrentVersionId($stagingRepo->getId()); $product = $productRepository->get("123456"); // Product SKU $product->setPrice("10"); // Price $productStaging->schedule($product, $stagingRepo->getId());
It may help you!
Thank you