AppCommerce Troubleshooting

Most issues can be resolved by trying the following:

  1. Make sure your WooCommerce API key and secret are correct, and saved to your integration settings
  2. Make sure all AppPresser plugins, WooCommerce, and AppCommerce are updated to the latest versions
  3. Visit your permalinks page and click save
  4. Rebuild your app and refresh (if using the browser preview)

If that doesn't fix it, please try the following:

  1. Regenerate your WooCommerce API key, and re-save your new key and secret in myapppresser.com. Rebuild and try again.
  2. Install our plugin blocker in your mu-plugins folder
  3. Visit the Settings => Plugin block page, and deactivate all plugins except WooCommerce
  4. Check the "Deactivate for WP-API Calls" setting
  5. Save and try again

If it's still not fixed and you have an error message, please see the error glossary below for a potential solution. Otherwise gather more information as described below and contact us.

Support

If the above steps do not fix the issue, we will need more information to help you fix it.

  1. Please enable debugging in your app dashboard
  2. Use our support contact form and fill out all details

Error Glossary

Error

"Unauthorized" or "Sorry, you cannot list resources."

Explanation

Your WooCommerce REST API keys are incorrect, or your server is blocking the app.

Solution

Regenerate your API keys and make sure you copy/paste them without error. Save and rebuild your app.

It is also possible that your server has security that is blocking the app. That could be a firewall, security plugin, or host-level security. If re-generating your keys does not work, deactivate any security plugins, and contact your web host about the issue.


Error

Access to XMLHttpRequest at 'https://.../wp-json/appcommerce/v1/cart/add' from origin 'http://...' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

Explanation

Something is setting your Access-Control-Allow-Origin header to a wildcard, it must be changed.

Solution

Uncheck "Enable CORS" in the AppPresser settings, and add the following code via plugin, and change the domain name listed.

add_action('rest_api_init', function() {
header('Access-Control-Allow-Origin: https://mysite.com');
});

Error

Access to XMLHttpRequest at ... CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

Explanation

That means that a plugin or file on the server has some code set that isn't working with our app.

This is not a problem with our code, but it is related to WooCommerce API authentication in the build files woo.ts

Possible Solutions

This was a conflict with App Facebook Connect 2.6.3 and below. Update to 2.6.3 or above.

Deactivate the AppPresser CORS setting.

You can also try adding this code to a plugin:

add_action('rest_api_init', function() {
header("Access-Control-Allow-Origin: https://mysite.com");
header("Access-Control-Allow-Credentials: true");
});

Note that this is somewhat insecure, 

If those don't fix it, a plugin or server configuration is setting CORS to "*", need to find that plugin and deactivate it, or fix the server configuration.


Error

preflight OPTIONS request is returning net::ERR_EMPTY_RESPONSE

Explanation

The app sends a preflight OPTIONS request to see if the server, the server needs to send back a true response.

Solution

Have customer contact web host and tell them we are getting an empty response to a pre-flight OPTIONS request. We need to get a "true" response. Ask them to implement the following:
Access-Control-Allow-Credentials set to "true" for all responses returned by the server (PUT, GET, POST, DELETE, OPTIONS)

Getting error: Sorry, you cannot list resources.

Edit your .htaccess to include authorization and overcome 401 error.
(should be in the order shown)

<IfModule mod_rewrite.c>

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Error
Access-Control-Allow-Credentials has the wrong value
Solution
Add this code via plugin:
add_action('rest_api_init', function() { 
header('Access-Control-Allow-Credentials: true');
});
	
If none of this fixes your issue, more troubleshooting tips can be found  in this article.