Streaming live at 10am (PST)

Archeiving SKUs via that API does not work

I have been trying to use the api to mark a SKU as _archived.

The documentation says this property exists [https://developers.webflow.com/?shell#skus-collection-mode](http://SKU Model)

when I make a call to PATCH /sites/:site_id/products/:product_id/skus/:sku_id

it returns successful, but doesn’t change the value of the field (other fields such as name work).

Is this possible? Or is there another way I am supposed to mark a SKU as unavailable? I don’t want to delete it, because it may become available again.

I am able to change this field for items in the Product collection model.

@Robson - are you sending:

"_archived": true,

Through with your patch in the body of the request?

yes, but I also have to include the existing values for ‘sku-values’

Example: If I do the following

curl 'https://api.webflow.com/sites/xxxxxxxx/products/xxxxxxx/skus/xxxxxxx' \
  -H "Authorization: Bearer xxxxxxxxxxxxx" \
  -H 'accept-version: 1.0.0' \
  -H "Content-Type: application/json" \
  -X PATCH \
  --data-binary $'{
        "fields": {
          "_archived": true
        }
      }'

I will get the following error (I have no idea why this is either?):

{"msg":"Variant \"undefined\" is missing option \"Color\" for product \"Thing2\".","code":409,"name":"Conflict","path":"/sites/xxxxxx/products/xxxxx/skus/xxxxxx","err":"Conflict: Variant \"undefined\" is missing option \"Color\" for product \"Thing2\"."}

if I add the existing sku-values

curl 'https://api.webflow.com/sites/xxxxxxx/products/xxxxxx/skus/xxxxxx' \
  -H "Authorization: Bearer xxxxxxxxx" \
  -H 'accept-version: 1.0.0' \
  -H "Content-Type: application/json" \
  -X PATCH \
  --data-binary $'{
        "fields": {
          "sku-values": {
            "yyyyyyyyyy": "zzzzzzzzzzz"
          },
          "_archived": true
        }
      }'

i will get a successful response… but the archived property will be unchanged:

{“price”:{“value”:120,“unit”:“USD”},"_archived":false,"_draft":false,“sku-values”:{“yyyyyyyyyy”:“zzzzzzzzz”},“download-files”:,“name”:“Cloak Of Invisibility Color: Smoke Grey”,“slug”:“cloak-of-invisibility-color-smoke-grey”,“product”:“xxxxxxxxxxx”,“updated-on”:“2020-09-29T17:49:29.131Z”,“updated-by”:“xxxxxxxxxxx”,“created-on”:“2020-09-29T17:43:20.894Z”,“created-by”:“xxxxxxxxx”,“published-on”:null,“published-by”:null,"_cid":“xxxxxxxxx”,"_id":“xxxxxxxxx”}

@Robson - hmm, that is odd. I don’t have an ecommerce store to test with, so I’m not sure I can help much from here. Have you tried not wrapping in the fields object? Just something like

--data-binary $'{"_archived": true}'

I’m just wondering if it’s a nesting issue since it seems like it’s wanting to modify a variant rather than the sku.

No dice

"msg":"Request is malformed: Body should have required property 'fields'","code":400,"name":"BadRequestError"

@Robson - welp, that wasn’t it :slight_smile: haha, umm anyone with API experience have any thoughts? @webdev @WebDev_Brandon