WooCommerce API Return 404 Not Found

I’m working on WooCommerce API, but I have problem with request.

Sometimes the API request return 404 or redirect to “my-account”.

Read More

API request example :

https://example.com/index.php/wc-api/v3/products?consumer_key=ck_XXXXXXXXX&consumer_secret=cs_XXXXXXXXX`.

Pretty links are enabled.

Here is my .htacess

# BEGIN WordPress
 <IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /
 RewriteRule ^index.php$ - [L]
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . /index.php [L]
 </IfModule>
# END WordPress

Any ideas ?

Related posts

1 comment

  1. Please download SDK from here: https://packagist.org/packages/automattic/woocommerce
    and take guidance from here: https://woothemes.github.io/woocommerce-rest-api-docs/.
    And create api credential form wordpress admin end woocommerce>settings>add new key

    $client = 'ck_63aade4xxxxxxxxxxxxxxx'; //put client key
    $secret = 'cs_673d7cdxxxxxxxxxxxxxxx'; //put secret key
    
    
    require __DIR__ . '/restapi/vendor/autoload.php'; //give your sdk autoload.php path
    
    
    use AutomatticWooCommerceClient;
    
    $woocommerce = new Client(
        'http://localhost:8888/woocommerce/', //site url
        $client, 
        $secret, // Your consumer secret
        [
            'version' => 'v3' // WooCommerce API version
        ]
    );
    
    print_r($woocommerce->get(''));
    

Comments are closed.