• Resolved yabdali

    (@yabdali)


    Hi,

    I get a strange error when checking Chrome developer console. For some reason, WordPress tries to fetch /wc/store/v1/cart?_locale=user but keeps getting 404 error. When I use /wp-json/wc/store/v1/cart?_locale=user I get status code 200! I tried going to permalink and hitting save, the settings use post-name settings in permalink! The snapshot below shows the initiation tree in Chrome developer console. Appreciate your help. ( I am on the latest WP and WC, using Blocksy theme.)

    https://imgur.com/a/rS0AkPl

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @yabdali

    This could be due to a number of reasons, such as a misconfigured .htaccess file, or a conflict with another plugin or theme.

    I would recommend checking your .htaccess file to ensure it’s configured correctly. If you’re unsure, you can reset your .htaccess file by renaming it to .htaccess_old and then go to Settings > Permalinks and click “Save Changes”. WordPress will automatically generate a new .htaccess file.

    If the problem persists, try deactivating all your plugins except WooCommerce to see if the issue is resolved. If it does, reactivate your plugins one by one until you find the one causing the conflict.

    I hope this helps! If you have any other questions, feel free to ask.

    Thread Starter yabdali

    (@yabdali)

    We use Nginx, not Apache so .htaccess isn’t applicable. Even for Nginx config file, the only rewrite is for the sitemap Urlacher and nothing else!

    Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @yabdali

    In this case, I would suggest contacting your hosting provider or adding a specific rewrite rule to your Nginx config file to handle the /wc/store/v1/cart?_locale=user request. For example:

    location / {
    try_files $uri $uri/ /index.php?$args;
    }

    Please adjust this rule according to your specific setup. After making changes, don’t forget to reload or restart your Nginx server.

    Let me know how that goes. I’m here to help!

    Thread Starter yabdali

    (@yabdali)

    This is already there, have you looked at th3 screenshot of the W.C files calling the url which is return 404?

    Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @yabdali

    Yes, I saw.

    The 404 error you’re experiencing could be related to how your server is configured to handle REST API requests. Because the /wc/store/v1/cart?_locale=user is a REST API endpoint, and it seems like your server is not properly rewriting the URL for the API request, hence the 404 status code. And once you add the /wp-json, it can be found and accessed.

    Since you are using Nginx, you might need to add a specific rewrite rule to your Nginx configuration file to handle the REST API requests properly.

    If that doesn’t helps, I recommend reaching out to your hosting provider for further assistance as they might have more insight into your server’s specific configuration.

    I hope this provides some clarity. Please let us know if you have any other questions!

    Thread Starter yabdali

    (@yabdali)

    It is a self hosted on VPS, there is nothing wrong with the server configurations and it used to work fine a while ago. We just noticed this recently and it looks related to the WC updates and new functionality. The server doesn’t do rewrites out of the blue, there are no issues with the other service components and this used to work fine in the past. Just to pinpoint the issue, the woocommerce plugin has the /wc/store/v1/cart hardcoded in many places. Check the attached link of the files which have this hardcoded in the link below. You can use search to find the occurrences /wc/store/v1/cart.
    https://pastebin.com/QU4SRk35#

    Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @yabdali

    Thanks for sharing further details.

    You mentioned that you have checked your Nginx configuration and it seems to be correct. However, the issue might be related to how the REST API requests are being rewritten by your server. This is why you’re getting a 404 error when trying to access the /wc/store/v1/cart?_locale=user endpoint without the /wp-json prefix.

    I understand that you’ve found the /wc/store/v1/cart endpoint hardcoded in many places within the WooCommerce plugin. However, this is expected as it’s a standard WooCommerce REST API endpoint.

    Given that this issue started recently and your server configuration hasn’t changed, it might be related to a recent update of the WooCommerce plugin. I would recommend you to rollback to a previous version of WooCommerce to see if the issue persists.

    If rolling back doesn’t resolve the issue, it would be helpful to check the server logs for any errors related to the /wc/store/v1/cart endpoint. This might provide more insight into what’s causing the 404 error.

    Additionally, you can create a bug report in our GitHub repo, where our developer can check it and provide further insights. You can also ask for insight related to those on either the WooCommerce Advanced Facebook group or the WooCommerce Community Slack. Many of our developers hang out there and will be able to offer insights into your question.

    I wish I could help more, but hopefully, this gets you going in the right direction to get some further insight/information.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.