WooCommerce categories problem

Hello to all n8n masters!

I’m trying to create a product using the woocommerce product node, but I want it to automatically select the category using an expression.

the array with the ID is how the HTTP request manually works, but in the custom woo node it’s not working this way, or either with just the id number.

Do you guys know how to make it work?
The HTTP request requires a lot of manual work to make it work, and since a node is already created I wanted to use it.

Thank you for any help.

Hi @suardim, this is what the n8n WooCommerce node would try to do with the categories field when using the Product → Create operation. So it seems to treat this field as an array of strings. Perhaps you can try an expression such as {{ ["150"] }} and see if this does the job? You might still get the warning icon next to the field, but should hopefully be able to execute the node nevertheless.

Sorry that didn’t work either…

Can @MutedJam please explain why this error is getting when I am creating the products using HTTP node. I need the category id value from the previous node when I am passing this inside HTTP Request this error is getting

Hey @Babitha,

Looks like WooCommerce is not happy with the data you are sending it, Looking at the value of categories it has [Array: [null]] so it could be that the Set catid node doesn’t have an id value for the 8th item. Without seeing more of your workflow and the output from the nodes it is hard to say though.

1 Like

That worked for me.

I am using the updateWooProdutct to update the category via HTTP Request since I was note able to do that using the WooCommerce node.

Hi Jon,
Thank you for your response. My problem solved and I presented the demo successfully

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.