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

andyellerton
New Member
1 0 0

Hi Fei

 

We're hitting the same error returned - did you ever find a solution ?

0 Likes
Fei1
Tourist
12 0 3

hi @andyellerton,

Well the only solution I have is to enforcing the rule... but depending what the client want. If the client want:

1. keep the compare_at_price

then we just need to alert them there is an issue updating the variant due to this requirement.

2. don't really care about the compare_at_price

then we just check is the compare_at_price is bigger than the price value? if so then we can use the given compare_at_price. If not I just overwrite it to NULL (don't use zero... that won't work) and I saw many people using compare_at_price = 0 instead of setting it to null.....

Unfortunately you would need to assuming the users input the wrong value.

Hope this help.

 

 

ericdude4
Shopify Partner
8 1 3

Yea this is really throwing me off. In the Admin interface, a merchant is totally able to set the "Compare at price" to whatever they want. Then in the API we get blocked. Are we really supposed to mess with a variant's compare at price just so we can change the price?

0 Likes
Maris
Shopify Partner
307 5 66

Totally agree @ericdude4 - the Admin validation logic should match the API validation.

At least, the API validation should not be more strict here than the Admin UI allows - our Merchants are confused why they can set that in the Admin manually, but cannot import.

It frustrates them...

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

I just encountered this problem myself yesterday. I have collections that rely on compare-at-price = 0, which means nothing is on sale. I suppose compare < 1 might produce the same result, but it's a lot less clear. 

What I personally find much more annoying is that the API will give you variant information that you can't save back to the same endpoint. This led to a particularly frustrating bug hunt with the Shopify Python Api which creates a complete variant object and then fails when attempting to save a modified version back to shopify. 

I see a few possible solutions that shopify could hopefully implement:

  • Return to 2020-01 functionality (API matches UI restrictions and allows compare at = 0) 
  • Match the API behavior in the UI (don't allow a user to save when Price < compare-at-price) 
  • Add "Null" to the values that a smart collection will compare to EG: "Compare at price equals Null or 0" 
  • Treat Null as 0 for equality purposes so "Compare at price equals 0" also catches Null values (probably a terrible idea) 
0 Likes
Maris
Shopify Partner
307 5 66

Hello, @Fei1 !

Maris from Excelify app here.

Yes, that is right - the new Shopify API changes require the Variant Compare At Price to be higher than the Variant Price. We definitely feel your frustration and agree this is not a fair rule because the Admin allows setting any value at the Compare At Price manually, and Shopify native import too.

I have written to Shopify about this concern, and let's see what they can offer as a solution...

Maris
Excelify.io

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

Hi, all!

Can you please give some real-life cases on why do you need Price to be the same as Compare At Price; and why do you need sometimes Price to be higher than the Compare At Price?

That is - to raise the awareness in Shopify of this need, as the intended use for "Compare At Price" logically is "the higher price that other places usually sell for", and it's puzzling as to why the price should match the Compare At Price, or even be higher than that. Maybe some important use-cases were overlooked?

According to information from Shopify - it's planned to enforce those same validations in Shopify Admin and CSV import after Black Friday.

Thanks so much!

 

Matrixify (Excelify) | Bulk Import Export Update Migrate | https://matrixify.app
Villoid_Owner
New Member
1 0 0

 

The problem is not that it is not consistent between Admin and the API

The problem is that this is not how retail works.

 

Retail works this way:

Products have RRP (Recommended Retail Price) or "Compare At" price - which should be the same thing.

When they land in your shop, your PRICE is equal to the RRP / Compare at.

 

If you (the retailer) desires to place a different price on the item, it could be a sale, or Black Week, or competitors dropped the price, or simply to get the stock out, you lower the price to get sales rolling. Hence: you lower the Price to be lower than the Compare At price.

 

There is absolutely no sane reason why your price should have to be different than the price that is recommended. On the contrary: This is default friggin behaviour. 

What are we missing here?

0 Likes
Fei1
Tourist
12 0 3

Hi ,

I understand and agree with you from the business point of view .

I just frustrated about the inconsistency between the admin interface and the API requirement from the app developer point of view.

Because user is using the admin interface to do their works and setup the "wrong" values without knowing, especially when they are doing a bulk edit. These values will impact on the workflow from a Shopify app rely on the API call to update and managing the product.

Can this be resolved? yes we can and we just need to enforcing the rule from back-end before we make the update call and explain to the user why our app changing their values.

All this can be avoided, if Shopify admin page using the same rule from API and block user from using the wrong value.

To be honest, I am more interested to know why Shopify has a different rule in the admin page? Is there a special reason Shopify would like to allow user to set a compare at price less than the product's price?

0 Likes