11

Is there any way to removing sale prices in different stores? using any script ? or using any other way except admin?

I'm using five different stores, default store is easy but other multi stores take ages as you can only change simple products manually and it looks like you can’t change the configurable products.

Basically, it takes about 20 minutes to take a shoe off sale which can’t be right.

3 Answers 3

1

Price is set at simple product level in Magento 2 (and configurable products will inherit the special price from simple products beneath it).

The quickest way to do it correctly would be to use the REST API inside a script. This is the best way if you're a beginner - Magento has created this as an interface for external integration which should be used wherever possible.

http://devdocs.magento.com/swagger/index_20.html#!/catalogProductRepositoryV1

The correct endpoint is catalogProductRepository's PUT /V1/products/{sku} -

Note that you need to put the storeview code into the calling URL as described here.

http://devdocs.magento.com/guides/v2.0/rest/rest_endpoints.html

Here is a good post on using a script with the REST API

GET or SET Product special price using REST API

Another option is to import a multi store CSV using Magento 2 import functionality - this is best if you're not familiar with Magento/PHP development:

Here is an article about it:

https://www.alexcorradi.org/blog/a-guide-on-how-to-import-export-products-in-magento-2

Otherwise if you have a test environment and are more confident with coding you can create your own script to update:

Inside a class you'd have:

protected $action;

public function __construct(\Magento\Catalog\Model\Product\Action $productAction) {
   $this->action = $productAction;
}

public function updatePrice($productIds, $data, $storeId) {
    $this->action->updateAttributes($productIds, $data, $storeId);
}

then to run it use the following;

 $specialPrice = null; // OR '' can't remember off the top of my head which clears it - perhaps either.

 $data = ['special_price' => $specialPrice];
 $storeId = 1; //whatever store id you like
 $productIds = [1,2,3,4,5,6,7]; //whatever product ids you wish to change.

 $this->updatePrice($productIds, $data, $storeId);

run for each store.

Apologies for any mistakes, I am just typing by memory. Please run on a test environment first!

1

Try1: You can use plugin approch for update sell price.

Try2: You can remove sell_price from default attribute set or disable this attribute so without any effort you can do this.

4
  • Try1 : Any plugin ? Try2 : Yes but I have added different prices for all stores, so how can I disable this attribute ? Commented Dec 19, 2017 at 5:50
  • Yeah you can disable that attribute Commented Dec 19, 2017 at 9:25
  • I mean which attribute you are talking about ? Commented Dec 19, 2017 at 9:28
  • "sell_price" need to disable or remove from default attribute_set Commented Dec 20, 2017 at 11:31
1

Use catalog price rules. Marketing > Catalog Price Rules

This way, you can set the sale prices by all stores or select stores and it is easy to update and enable or disable en mass.

You can set the conditions to match all manner of combinations: category/manufacturer/size/color/sku/mpn

You can also create attributes in the backend that you can use for catalog price rules. eg. I have an attribute 'season' with drop down options like 2017-4, which is winter products.

So I make a catalog price rule for: Manufacturer = Billabong, Category = Shirts, Season = 2017-4 and apply 20% off to products matching those criteria. And you can set the websites where the rule is applied, as well as the dates you want the rules to run.

You can also use color or sizes in your rules. This becomes very advantageous when the product hasn't changed names for a few years and there's an old colorway that you want to get rid of, you can set only the one color and or size combination to be on sale, while the rest of the configurable products stay the regular price.

2
  • thanks for response, actually I have already setup sale price for all of my multi-stores, so I needs to remove it from all of my stores. Also if I have added sales price for simple product of all associate product then that will also remove, so please suggest me if you have any solution for this one. Thanks in advance Commented Dec 19, 2017 at 5:46
  • Go to catalog, select all products > Update Attributes > check the "Special Price" and leave it blank. That will remove the sale price from all products and then you can start using the cart rules. If you have a lot of products, you may want to do this in batches of 500 products at a time to make things a little easier and not time out. It does take a while for the process to run, but in smaller batches it isn't too bad.
    – dawhoo
    Commented Dec 19, 2017 at 17:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.