Skip to content
This repository was archived by the owner on Oct 4, 2019. It is now read-only.
This repository was archived by the owner on Oct 4, 2019. It is now read-only.

Invalid parameter(s): meta_data [rest_invalid_param] #85

@willfaulds

Description

@willfaulds

Any attempts to update an order's meta_data fail.

This goes against the API documentation http://woocommerce.github.io/woocommerce-rest-api-docs/#order-properties

WordPress 4.9.2
WooCommerce 3.2.6
wc-api-php 2.0.0
Memory: 10 of 128 MB (8%) | WP LIMIT: 128 MB | PHP 7.1.12

Outline of API call (PHP using wc-api-php 2.0.0):

$woocommerce = new Client(
    'https://www....',
    '...',
    '...',
    [
        'wp_api' => true,
        'version' => 'wc/v2'
    ]
);

...create/load an wooOrder with $orderId

$data = [
  'id' => $orderId,
  'meta_data' => [ '_custom_field' => '24.54' ]
];

$woocommerce->put('orders/'.$orderId, $data);

ERROR log

[31-Jan-2018 09:49:53 Europe/London] PHP Fatal error:  Uncaught Automattic\WooCommerce\HttpClient\HttpClientException: Error: Invalid parameter(s): meta_data [rest_invalid_param] in /home/vendor/automattic/woocommerce/src/WooCommerce/HttpClient/HttpClient.php:348
Stack trace:

#0 /home/vendor/automattic/woocommerce/src/WooCommerce/HttpClient/HttpClient.php(378): Automattic\WooCommerce\HttpClient\HttpClient->lookForErrors(Object(stdClass))

#1 /home/vendor/automattic/woocommerce/src/WooCommerce/HttpClient/HttpClient.php(414): Automattic\WooCommerce\HttpClient\HttpClient->processResponse()

#2 /home/vendor/automattic/woocommerce/src/WooCommerce/Client.php(69): Automattic\WooCommerce\HttpClient\HttpClient->request('orders/7712', 'PUT', Array)

#3 /home/woocommerce.php(95): Automattic\WooCommerce\Client->put('orders/7712', Array)

#4 /home/vendor/automattic/woocommerce/src/WooCommerce/HttpClient/HttpClient.php on line 348

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions