wyqydsyq
wyqydsyq

Reputation: 2040

Creating a hidden product

I am trying to POST the contents of request.json to /admin/products.json, but Shopify replies with the contents of response.json.

As you can see in request.json, I have specified "published_at" to be null in attempt to make the product "hidden", but then Shopify is overriding that value with a generated timestamp as in response.json. If I hide a product via the Shopify Admin panel, then GET /admin/products.json, the "published_at" correctly has a value of null.

Either the documentation is incorrect, or there is a bug with the Shopify API (ignoring the "null" value on "published_at" in POST requests).

Upvotes: 0

Views: 438

Answers (1)

Wrikken
Wrikken

Reputation: 70540

according to these examples, the correct way to prevent publishing of new products, is to set:

  published: false

As to why the ruby gem example differs from the json one: well, the json one is about a new product, the ruby one is about updating existing products, that might be a difference, but I'd call it an inconsistency in the API, most likely due to the fact they consider a null published_at for new products the same as unset, and default to now.

Upvotes: 2

Related Questions