Giter Site home page Giter Site logo

Comments (9)

zeeshan-m avatar zeeshan-m commented on September 16, 2024 1

I just figured out the issue.. Just incase anyone has this issue, my issue was that a plugin that is no longer installed (WP- Super Cache Manager) was throwing an error into the API return as a comment, so it wouldn't display in the browser unless you viewed the source. I had to go delete the configuration it added into wp-config.php, and that fixed it.

from woocommerce-rest-api-client-library.

kloon avatar kloon commented on September 16, 2024

@oBigZee can you try with $wc_api->get_orders( array( 'filter[limit]' => 10 ) ); and then post the result here?

from woocommerce-rest-api-client-library.

zeeshan-m avatar zeeshan-m commented on September 16, 2024

Just tried it. I still get the following:

object(stdClass)#1801 (1) {
  ["errors"]=>
  array(1) {
    [0]=>
    object(stdClass)#1726 (2) {
      ["code"]=>
      string(3) "200"
      ["message"]=>
      string(19) "cURL HTTP error 200"
    }
  }
}

from woocommerce-rest-api-client-library.

zeeshan-m avatar zeeshan-m commented on September 16, 2024

I'm not sure what the issue is, since there's enough memory to transfer over the data, the data comes over sorta fine as a string (json_decode returns a syntax error on it though). Interacting with Wordpress directly still works perfectly as well.

from woocommerce-rest-api-client-library.

kloon avatar kloon commented on September 16, 2024

Post the result as a JSON string, there might be a char causing an issue somewhere.

Sent from my iPhone

On 17 Oct 2014, at 7:12 PM, oBigZee [email protected] wrote:

I'm not sure what the issue is, since there's enough memory to transfer over the data, the data comes over sorta fine as a string (json_decode returns a syntax error on it though). Interacting with Wordpress directly still works perfectly as well.


Reply to this email directly or view it on GitHub.

from woocommerce-rest-api-client-library.

zeeshan-m avatar zeeshan-m commented on September 16, 2024
{"orders":[{"id":1318,"order_number":"#1318","created_at":"2014-10-18T02:19:00Z","updated_at":"2014-10-18T02:19:53Z","completed_at":"2014-10-18T02:19:53Z","status":"processing","currency":"CAD","total":"0.00","subtotal":"0.00","total_line_items_quantity":0,"total_tax":"0.00","total_shipping":"0.00","cart_tax":"0.00","shipping_tax":"0.00","total_discount":"0.00","cart_discount":"0.00","order_discount":"0.00","shipping_methods":"","payment_details":{"method_id":"paypal","method_title":"PayPal","paid":false},"billing_address":{"first_name":"testName","last_name":"testLname","company":"","address_1":"","address_2":"","city":"","state":"","postcode":"","country":"","email":"[email protected]","phone":""},"shipping_address":{"first_name":"","last_name":"","company":"","address_1":"","address_2":"","city":"","state":"","postcode":"","country":""},"note":"","customer_ip":"","customer_user_agent":"","customer_id":"0","view_order_url":"http:\/\/test.com\/my-account\/view-order\/1318","line_items":[],"shipping_lines":[],"tax_lines":[],"fee_lines":[],"coupon_lines":[],"customer":{"id":0,"email":"[email protected]","first_name":"testName","last_name":"testLname","billing_address":{"first_name":"testName","last_name":"testLname","company":"","address_1":"","address_2":"","city":"","state":"","postcode":"","country":"","email":"[email protected]","phone":""},"shipping_address":{"first_name":"","last_name":"","company":"","address_1":"","address_2":"","city":"","state":"","postcode":"","country":""}}}]}

I limited the order returns to just 1. Running var_dump(json_decode()) on this returns "NULL".

from woocommerce-rest-api-client-library.

zeeshan-m avatar zeeshan-m commented on September 16, 2024

Hey, I'm still having this issue, any help is much appreciated!

from woocommerce-rest-api-client-library.

zeeshan-m avatar zeeshan-m commented on September 16, 2024

Hi,
I'm still having issues with this. I tried the following code:

$wc_api = new WC_API_Client( $consumer_key, $consumer_secret, $store_url );
$wc_api->set_return_as_object(false);
$orders = $wc_api->get_orders(array( 'status' => 'processing,on-hold', 'filter[limit]' => 5 ));

echo "<pre>";
var_dump(json_decode($orders));
switch (json_last_error()) {
    case JSON_ERROR_NONE:
        echo ' - No errors';
    break;
    case JSON_ERROR_DEPTH:
        echo ' - Maximum stack depth exceeded';
    break;
    case JSON_ERROR_STATE_MISMATCH:
        echo ' - Underflow or the modes mismatch';
    break;
    case JSON_ERROR_CTRL_CHAR:
        echo ' - Unexpected control character found';
    break;
    case JSON_ERROR_SYNTAX:
        echo ' - Syntax error, malformed JSON';
    break;
    case JSON_ERROR_UTF8:
        echo ' - Malformed UTF-8 characters, possibly incorrectly encoded';
    break;
    default:
        echo ' - Unknown error';
    break;
}

Outputs this:

NULL
- Syntax error, malformed JSON

from woocommerce-rest-api-client-library.

epsimatic avatar epsimatic commented on September 16, 2024

@kloon I have found this topic by a chance.

$wc_api->get_orders( array( 'filter[limit]' => 10 ) ); is extremely useful an looks totally undocumented anywhere else.

Thank you!

from woocommerce-rest-api-client-library.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.