How to Add/Update Special price of Product Magento 2?

You can Add or Update special price of the product by the SpecialPrice Interface. Catalog module contains the Special Price interface to update the special price of the product.

Base defination of the update special price of the product,
public function update(array $prices);

$prices array parameter,

'store_id' => (int) Store Id. Required.
'sku' => SKU of the product
'price' => (float) price value
'price_from' => (string) Special price from date value in Y-m-d H:i:s format in UTC. Optional.
'price_to' => (string) Special price to date value in Y-m-d H:i:s format in UTC. Optional.

Update Price Programmatically using the code snippet,

namespace Jesadiya\SpecialPriceUpdate\Model;

use Exception;
use Magento\Catalog\Api\SpecialPriceInterface;
use Magento\Catalog\Api\Data\SpecialPriceInterfaceFactory;

class UpdateSpecialPrice
     * @var SpecialPriceInterface
    private $specialPrice;

     * @var SpecialPriceInterfaceFactory
    private $specialPriceFactory;

     * constructor.
     * @param SpecialPriceInterface $specialPrice
    public function __construct(
        SpecialPriceInterface $specialPrice,
        SpecialPriceInterfaceFactory $specialPriceFactory
    ) {
        $this->specialPrice = $specialPrice;
        $this->specialPriceFactory = $specialPriceFactory;

     * Update special price
     * @return bool
    public function getSpecialPriceData()
        $sku = '24-MB01';
        $price = 10.99; //Special Price
        try {
            $priceFrom = '2020-12-01'; // future date to current date
            $priceTo = '2025-10-15'; // future date to price from

            $updateDatetime = new \DateTime();
            $priceFrom = $updateDatetime->modify($priceFrom)->format('Y-m-d H:i:s');
            $priceTo = $updateDatetime->modify($priceTo)->format('Y-m-d H:i:s');

            $prices[] = $this->specialPriceFactory->create()

            $product = $this->specialPrice->update($prices);
        } catch (Exception $exception) {
            throw new Exception($exception->getMessage());

        return $product;

You have to create array factory of Data\SpecialPriceInterface and set SKU, Price, price_from, price_to and store id.


Magento Commerce, you need to check Product from the Admin panel. You can see special price as Scheduled Changes.

add special price
add / update special price