• I am building an android app of a woocommerce website using with ionic 3. But i can not sign up a user from the app for the problem of cors policy. data is not fetching from url to origin due to cors policy. How can I solve the issue?

    please help

Viewing 4 replies - 1 through 4 (of 4 total)
  • How did you implement the login/signup?

    For reference: Woocommerce users or customers are actually WordPress users, more like blog subscribers (just like woocommere products are WordPress posts, so to create a user you could use WP_API functions for that purpose.

    wp_create_user To create users with minimum parameters (username, password, and email).
    wp_insert_user To create users with extended user data.

    I assume that user roles must match those that woocommerce handle (customers or shop managers) Now there’s also an endpoint for creating/updating/listing customers in WooCommerce REST API (https://woothemes.github.io/woocommerce-rest-api-docs/#customers) but there’s no login/auth support at the moment.

    For login/authentication there are two mechanisms in the WP_API: CookieAuth and OAuth If you explain what you are trying to accomplish it would be easier to help.

    Read more here: https://stackoverflow.com/a/32980962/4469947

    Thread Starter mridulcse

    (@mridulcse)

    Thanks @earlpeterg for your response.

    I am building an android application for a woocommerce website using IONIC 3 framework. When I use POST method for sending user data to woocommerce database then CORS policy blocked the request (CROSS origin request server) but get method is working fine. I am using bluehost cloud server.

    How can I post data to woocommerce database from my app.. Please help

    Have you checked the .htaccess file of your WordPress installation? You can find this file in the root of your WordPress. You should have the following code on top of your file.

    RewriteEngine On
    RewriteCond %{REQUEST_METHOD} OPTIONS
    RewriteRule ^(.*)$ $l [R=200,L]
    Thread Starter mridulcse

    (@mridulcse)

    Thanks again for response @earlpeterg. I have already used the code you gave above to my htaccess file. But problem not solved. Moreover it corrupted my woocommerce website. I am trying to solve the CORS problem since last 15 days. But I am failing again and again. Do you have any other option?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘how to solve cors policy issue for woocommerce in ionic 3’ is closed to new replies.