Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WooCommerce Integration is Spotty #4017

Closed
aaversa opened this issue May 10, 2024 · 7 comments
Closed

WooCommerce Integration is Spotty #4017

aaversa opened this issue May 10, 2024 · 7 comments

Comments

@aaversa
Copy link

aaversa commented May 10, 2024

I have the WooCommerce module installed and correctly configured with my store's API key. My store is hosted on the same domain (different server), on enterprise-grade hardware. We previously used Helpscout which integrated with the store without any issue.

However, with Freescout, when loading a given conversation with a customer that DEFINITELY has WooCommerce orders, the majority of the time the orders section simply 'spins' for 30-45 seconds before timing out and saying there are no orders.

This doesn't happen 100% of the time. Sometimes if I refresh the page a few times, the orders will eventually load. Some customers' orders load instantly, too. It's not clear what if any pattern there is.

We have many, many services integrated with our WooCommerce store and none of them exhibit this behavior so I don't think it's an issue with our WooCommerce database or server response time.

Our Freescout installation is on a Hetzner server with 3 vCPUs and 4GB of RAM. I have been monitoring our CPU utilization and it has never crossed 50%.

PHP version: 8.3
FreeScout version: Latest
Database: Nginx
Are you using CloudFlare: No

EDIT: I just checked the Laravel log and I am seeing a bunch of this:

[WooCommerce] HTTP Status Code: 0 (Store not found at the specified URL) | Requested resource: https://impactsoundworks.com/wp-json/wc/v2/orders

I can most definitely guarantee our store is at https://impactsoundworks.com/. Also, this integration was (at least sort of) working yesterday... What's going on?

@freescout-helpdesk
Copy link
Collaborator

The only way to figure it out is to debug on your server. Try https://github.com/freescout-helpdesk/freescout/wiki/Debugging

@aaversa
Copy link
Author

aaversa commented May 10, 2024

This is the error in the logs, are you looking for more detail than this?

[WooCommerce] HTTP Status Code: 0 (Store not found at the specified URL) | Requested resource: https://impactsoundworks.com/wp-json/wc/v2/orders

I am 100% sure this is the correct endpoint. I have just used Postman and tested it for myself - it is correct and returning data as expected with a simple GET request.

@freescout-helpdesk
Copy link
Collaborator

#4017 (comment)

@freescout-helpdesk
Copy link
Collaborator

Unfortunately we can't tell what can be the reason of the problem from here. The only way to do it is for someone to investigate it on your server.

@aaversa
Copy link
Author

aaversa commented May 14, 2024

By "your server" do you mean the server hosting Freescout? If so, as I showed in the logs, the only error is that HTTP Status Code 0. But that doesn't make sense as, like I said, every other application that uses my store's API (there are dozens) work perfectly, including Postman running on my computer. Is the WooCommerce module open source? Can I open it up and see if I can debug this myself?

EDIT: I've done this and spent awhile testing. The problem seems to be a cURL timeout... Our WooCommerce store db is quite large as we have many hundreds of thousands of orders. Requesting the orders on-demand like this takes about 40 seconds when going through the WP/Woo application layer. (A direct MySQL query is much much faster.)

I was looking into how Helpscout handles this, and it seems like rather than on-demand grabbing orders when you first open an email, it uses a store server-side plugin possibly in combination with caching data on the Freescout side.

I'm curious if this module is being used by any other stores in the 400k+ order range and how it performs for them.

In the short term perhaps I can adjust the cURL timeout manually.

@aaversa
Copy link
Author

aaversa commented May 16, 2024

@freescout-helpdesk I have just rewritten some aspects of the WooCommerce integration.

The retrieval time has gone from 40s to less than 1 second.

I did this by working with Automattic to create a new endpoint via WC plugin that is orders of magnitude faster. I then added an integration via a separate plugin on the Orders page for customers allowing them to submit a ticket easily. See screenshots.

The plugins are not really polished but they do work and makes the functionality equivalent to Helpscout.

Are you interested in taking a look at our work?

need help form
Orders screen

@freescout-helpdesk
Copy link
Collaborator

You can send the code to support@freescout.net
We'll take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants