Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updateInventory() fails with no variations/combinations #46

Open
StanProg opened this issue Oct 22, 2018 · 2 comments
Open

updateInventory() fails with no variations/combinations #46

StanProg opened this issue Oct 22, 2018 · 2 comments

Comments

@StanProg
Copy link

Hi guys,

I'm using this SDK for synchronization of the quantity of our products.

Etsy-php version: 0.12.1
PHP version: 5.5.9
OAuth version: 1.2.3

The code that I'm using is the following (sample data):

$argument = [
    'params' => [
        'listing_id' => 486961999,
    ],
    'data' => [
        'products' => [
            'json' => json_encode([
                0 => [
                    'sku' => 'HB_XXX123',
                    'offerings' => [
                        0 => [
                            'price' => '19.90',
                            'quantity' => 999,
                        ],
                    ],
                ],
            ]),
        ],
    ],
];

After calling the updateInventory() method with this argument I get an exception:

Etsy\EtsyRequestException: [1]: Invalid auth/bad request (got a 400, expected HTTP/1.1 20X or a redirect): Array
(
    [products] => [{"sku":"HB_XXX123","offerings":[{"price":"19.90","quantity":999}]}]
)

All combinations of property values must be supplied

So, in my case I do not have any combinations and yet the system requests such.

I suppose the problem is in the $argument that I'm passing to the method.

  1. Is there any way to update the quantity of a non-variation (non-combination) products?
  2. Is there a way to update only quantity, without updating the price?

Any idea @inakiabt ?

@Gnilya
Copy link

Gnilya commented Nov 27, 2018

Hi having the same issue did you come up with a fix ?

Cheers

@gijsve
Copy link

gijsve commented Mar 16, 2019

I found out, you need to supply an empty array of property_values, like:
$property_values = array();
// $offerings and $sku contain data
$products[] = array (
'property_values' => $property_values,
'offerings' => $offerings,
'sku' => $sku
);
$productsjson = json_encode($products);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants