• Resolved alexey8pro

    (@alexey8pro)


    We need through the API to get the number of downloads of files (downloads) by order number.

    In the API, we found this feature only through / wp-json/wc/v2 / customers/<id> / downloads

    But the problem is that our users are not registered on the site. Therefore, in the “Customers” field, we always have the value 0. This method does not work with such ID.

    How can we get a list of files by order number?

Viewing 1 replies (of 1 total)
  • Plugin Support con

    (@conschneider)

    Engineer

    Hi there,

    I did not look at all the endpoints, but I would assume you need to create your own one. You can try and make use of: https://docs.woocommerce.com/wc-apidocs/source-class-WC_Customer_Download_Data_Store.html#210-272 – the endpoint you listed above seems to make use of wc_get_customer_available_downloads( $customer_id )

    get_downloads() seems to accept order_id, so you can test and register an endpoint that sends the argument and then test whether you get output ok while not being logged in. I don’t expect this to work, because in order to be able view an order you must be logged in (I think). Guest downloads are validated differently, but I am not sure how to mimic this in an endpoint at all.

    Kind regards,

Viewing 1 replies (of 1 total)
  • The topic ‘API downloads files for order’ is closed to new replies.