Problem with Woocommerce node, fails on Product > Get All

Hey @Richard_Sessa_Alcara,

When you say users I take it you mean customers? I have just done a quick test on my local install with the same versions and I am able to retrieve all 302 test customers.

Do any of the other options work for you?

Hey @Jon !
Thank you for your reply. Yes, when I say user I talk about customers. I have the problem with the GET ALL option, with customers and products. The other options works fine.

Hey @Richard_Sessa_Alcara.

You have an email address set to the get all customers, That could be important I will give that a test today.

Hi @Jon! Have you been able to do the tests?

Hey @Richard_Sessa_Alcara,

I did give it a test but I was still not able to reproduce it, I did find that I don’t think the email filter actually works when you have the node set to “Return All” so I will need to do some more testing there.

If you drop the email filter on yours does it work as expected? How many customers are in your WooCommerce install as well? I am wondering if maybe it is failing because you have less than 100 so there is no pagination that needs to happen internally.

Hi @Jon! Without entering any email to filter it keeps giving me an error. I have more than 300 customers in my woocommerce.
However, in WP node, it works perfectly for me.

TypeError: Cannot read properties of undefined (reading 'split') at Object.woocommerceApiRequestAllItems (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/WooCommerce/GenericFunctions.js:36:49) at processTicksAndRejections (node:internal/process/task_queues:96:5) at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/WooCommerce/WooCommerce.node.js:128:40) at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:652:28) at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:596:53

That is very odd, I have over 300 in my setup and it is working. Can you run the workflow below and send over the output of the last node, I have set it up so that it should replace any sensitive values but make sure you check first :slight_smile:

1 Like

The last node returns me this result.

No data to show - item(s) exist, but they’re empty

Until the previous one I have data, but only 20

Interesting, in that case can you check the http request node and check the headers to see if there is a link in there? It sounds like your woocommerce install is not responding as expected…

Although only having 20 items is odd as it is told to return 100, are you sure it was the correct site and it is customers you are trying?

Hi @Jon!
The HTTPRequest node has the following headers

"headers":
{
"date":
"Sun, 09 Jul 2023 08:00:14 GMT",
"content-type":
"application/json; charset=UTF-8",
"transfer-encoding":
"chunked",
"connection":
"close",
"x-robots-tag":
"noindex",
"x-content-type-options":
"nosniff",
"access-control-expose-headers":
"X-WP-Total, X-WP-TotalPages, Link",
"access-control-allow-headers":
"Authorization, X-WP-Nonce, Content-Disposition, Content-MD5, Content-Type",
"expires":
"Wed, 11 Jan 1984 05:00:00 GMT",
"cache-control":
"no-cache, must-revalidate, max-age=0",
"x-wp-total":
"21",
"x-wp-totalpages":
"1",
"allow":
"GET, POST",
"x-frame-options":
"SAMEORIGIN",
"vary":
"Accept-Encoding",
"x-xss-protection":
"1; mode=block",
"referrer-policy":
"",
"age":
"0",
"server":
"HTTPd",
"accept-ranges":
"bytes"

I’ll give you a screenshot of my woocommerce customers

Hey @Richard_Sessa_Alcara

I see in the headers:

"access-control-expose-headers":
"X-WP-Total, X-WP-TotalPages, Link",

Is it possible that you are using W3 Total Cache?
Have you tested your workflow by previously deactivating the cache plugin?

There is some WordPress community thread commenting on W3 Total Cache interference with WooCommerce API.

:wink:

1 Like

Hi @martinhache!
Uso WP-Optimize
Voy a probar desactivandolo

Hi @Jon @martinhache !
I have launched the workflow that Jon passed on, with the cache plugins disabled, with the same result. These are the headers.


"headers":
{
"date":
"Mon, 10 Jul 2023 17:08:54 GMT",
"content-type":
"application/json; charset=UTF-8",
"transfer-encoding":
"chunked",
"connection":
"close",
"x-robots-tag":
"noindex",
"x-content-type-options":
"nosniff",
"access-control-expose-headers":
"X-WP-Total, X-WP-TotalPages, Link",
"access-control-allow-headers":
"Authorization, X-WP-Nonce, Content-Disposition, Content-MD5, Content-Type",
"expires":
"Wed, 11 Jan 1984 05:00:00 GMT",
"cache-control":
"no-cache, must-revalidate, max-age=0",
"x-wp-total":
"20",
"x-wp-totalpages":
"1",
"allow":
"GET, POST",
"x-frame-options":
"SAMEORIGIN",
"vary":
"Accept-Encoding",
"x-xss-protection":
"1; mode=block",
"referrer-policy":
"",
"age":
"0",
"server":
"HTTPd",
"accept-ranges":
"bytes"

Hey @Richard_Sessa_Alcara,

I guess the good news here is n8n is working as expected, You WooCommerce instance is only returning a few items with no link for the next page.

Do you have any other plugins installed?

Hi @Jon !

Yes, I have installed and actived this plugins:

  • Actispam Bee
  • Astra Pro
  • Astra widgets
  • Autoptimize
  • Chatwoot plugin
  • Disponibilidad para WC Bookings
  • Gestor de pestañas de cuenta
  • Gravity Forms
  • If menu
  • Intro Tour tutorial
  • Jetpack CRM
  • Kadence Blocks
  • Limit Login Attempts Reloaded
  • MailPoet
  • ManegeWP worker
  • Personalizar campos checkout
  • Plantillas de inicio
  • Pretty links
  • Profile Builder Pro
  • Proxy Cache purge
  • Spectra
  • Spreadsheet Integration – Google sheet Integration, Sync & Display
  • Toolset Blocks
  • Toolset forms
  • Toolset types
  • User switching
  • Username changer
  • Woocommerce
  • WC Booking
  • WC Stripe gateway
  • WC suscriptions
  • Wordpress optimizado

Hey @Richard_Sessa_Alcara,

That is a few to work through, I would maybe disable them one at a time to work out which one is causing the API to not work as expected or maybe ask the WooCommerce community.

1 Like

Hey @Jon

The quickest way to find out which plugin is causing the conflict with WooCommerce API Rest is to staging the site, and on this, disable all plugins except WooCommerce and check if it works properly.

From there, activate each plugin until you find the one that blocks the API.

To begin with, for me the “suspects” can be:

  • Autoptimize
  • Jetpack CRM
  • Limit Login Attempts Reloaded
  • Proxy Cache purge
  • User switching
  • Username changer
  • Wordpress optimizado
2 Likes