Create Product API throw Error "Compare at price needs to be higher than Price"

Fei1
Tourist
12 0 3

Hi,

I has been getting this error "Compare at price needs to be higher than Price" whenever I try to create a product with price that is equal to compared_at_price field.

The API call was doing fine, until recently I have update the version from 2019-04 to 2020-04.

My guess is one of the version release has changed this behavior. But I couldn't seems to find it from the release notes from Shopify.

While Shopify allow the user to have price = compared_at_price from the admin interface to create a new product. I just don't understand that why through API call has a different requirement in here?

Is there anyone could give me some information in regarding this error?

Thanks,

Fei

Replies 14 (14)
sam12341
Tourist
13 0 3

@Maris You ask for the reasons a retailer would need to set the compare-at-price to a number lower than price? The reasons are all artificially created by Shopify, but they are important: 

In many (maybe all?) shopify themes, if you have a compare at price that is anything other than 0 or Null, it is displayed. "Price 99.99, compare at price 99.99" ... this looks bad. This is the original sin and leads to all these other problems. 

Mistake 2: Smart collections have no negative filter options and its impossible to filter on null (compare-at-price == Null is impossible), so retailers are in the habit of using compare-at == 0 to signify a full price item

So, now I want to make a smart collection called "Not on Sale" which is just full-priced items. Because of mistake 1, i can't say price==compare-at-price, and because of mistake number 2, I can't filter on null, so I setup my new "full price apparel" collection like: "type=apparel, compare-at-price >0" and I create a discount code for that collection and pass it to my marketing team. With the new null behavior this is now impossible and I really don't understand how they expect retailers to work around it. 

In an ideal world, compare at price should always be MSRP (full price) and there should be some other mechanism to decide if it should be displayed or not, periodically setting it to 0 is a mess. But this behavior has been established and counted on, and now it sounds like it's being take away, hence people being cranky about it. 

Finally, others didn't sound as concerned, but I personally think it's bad practice to allow less flexibility through the API than through the UI. As a developer it's hard to explain to a client that you can't do in bulk what they can do manually through their admin page. 

Maris
Shopify Partner
308 5 66

Hi, folks!

Enormous thank you about your responses on this - I am sure Shopify will soon join those discussions and provide solutions to those issues and use-cases you are describing.

I have passed links from both of those forum threads to Shopify developer support.

The second thread is this one about the same issue: https://community.shopify.com/c/Shopify-APIs-SDKs/Compare-at-price-needs-to-be-higher-than-Price-API...

Most likely after BFCM, as I understand now everything revolves around that.

Maris

Matrixify (Excelify) | Bulk Import Export Update Migrate | https://matrixify.app
Maris
Shopify Partner
308 5 66

Hi, all!

Letting you know that we have made a workaround in the Excelify app which now allows both - importing/exporting the new Product Status field with the new Shopify API, AND also allows setting the Variant Compare At Price such that it's not required to be higher than the Variant Price.

All your earlier imports that were setting the Compare At Price as equals or lower than the Price should work now.

There is a high probability that Shopify will move forward and will enforce that requirement in the Admin after the BFCM, but still, a slight chance that all of your feedback made them reconsider this requirement as well.

Anyway, for now - it should work as you were used to (in the Excelify app).

So sorry for this stressful period, and really hoping it's some good news, for now, to live through the sales season.

Matrixify (Excelify) | Bulk Import Export Update Migrate | https://matrixify.app
sam12341
Tourist
13 0 3

did you just switch back to the old API version? What was the technical solution?

AndyLawler
New Member
1 0 0

setting the "compare_at_price" to be blank seemed to work for me:

03/12/2020 02:03:56.727 Send to Shopify: {"variant":{"id":321821347347452,"price":"340.00"}} = failed with "Compare at price needs to be higher than Price"
03/12/2020 14:37:40.158 Send to Shopify: {"variant":{"id":321821347347452,"price":"340.00","compare_at_price":""}} = worked