WooCommerce Node not updating SKU

Greetings everyone, I am trying to update a product in WooCommerce (specifically trying to assign it a SKU that I am getting from another source).
If I type the number manually it updates like a charm, but when I’m getting it from a previous node it returns an error.


“message”: “400 - {“code”:“rest_invalid_param”,“message”:“Invalid parameter(s): sku”,“data”:{“status”:400,“params”:{“sku”:“sku is not of type string.”},“details”:{“sku”:{“code”:“rest_invalid_type”,“message”:“sku is not of type string.”,“data”:{“param”:“sku”}}}}}”,

“name”: “Error”,

“stack”: “Error: Request failed with status code 400 at createError (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15) at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12) at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:269:11) at IncomingMessage.emit (node:events:402:35) at endReadableNT (node:internal/streams/readable:1343:12) at processTicksAndRejections (node:internal/process/task_queues:83:21)”


This is my workflow:

Using latest version with SQLite

Thanks and keep up the good work!

That is probably because the previous node is returning the SKU/ID as a string. In the example you shared, change the expression from {{$node["Set"].json["idtosku"]}} to {{parseInt($node["Set"].json["idtosku"], 10)}}

Thank you @RicardoE105 , I tried but I get the exact same error message.

Ahh, it looks like it’s the inverse. It’s a number but needs to be a string. So, do {{$node["Set"].json["idtosku"].toString()}}

Thanks! That solved it.

Great that it worked. Have fun.