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

Issues with updating inventory #29

Open
keyurshah opened this issue Sep 7, 2017 · 2 comments
Open

Issues with updating inventory #29

keyurshah opened this issue Sep 7, 2017 · 2 comments

Comments

@keyurshah
Copy link

keyurshah commented Sep 7, 2017

Thanks for the amazing library!

I first am creating a listing using the createListing method.

I am then trying to add inventory using the updateInventory method, but am getting errors about invalid param type

Invalid params for method "updateInventory": Invalid data param type "products"

If anyone has a sample of the final structure that I need to have in php to use the updateInventory method, that would be very helpful. This is not working for me.

        $etsy_listing_id = 999999999; //during testing, using a real listing id
        $primary_colors_id = 200;

        $colors = [
            [
                'property_id'   => $primary_colors_id,
                'property_name' => 'Primary color',
                'value_ids'     => [1213],
                'values'        => ['Beige'],
            ],
        ];

        $products =
            [
                [
                    'property_values' => [$colors[0]],
                    'sku'       => 'A-800',
                    'offerings' => [
                        [
                            'price'      => 15.00,
                            'quantity'   => 4,
                            'is_enabled' => 1,
                        ],
                    ],
                ],
            ];

        $data = [
            'params' => [
                'listing_id' => $etsy_listing_id,
            ],
            'data' => [
                'products' => json_encode($products),
                "price_on_property" => [$primary_colors_id],
                "quantity_on_property" => [$primary_colors_id],
                "sku_on_property" => [$primary_colors_id],
            ],
        ];

        $etsy_inventory_items = $this->etsy_api->updateInventory($data);

Thank You

@keyurshah
Copy link
Author

keyurshah commented Sep 7, 2017

I was able to get it to work, but I had to edit the methods.json line and change stringJSON to string

line 761
"products": "string",

I know there is a pending pull request, so not sure what is the correct way to get this to work.

Thanks.

#27

@magefast
Copy link

@keyurshah
I agree,
after change to type "string" - all works

Thanks @keyurshah

@keyurshah keyurshah reopened this Apr 18, 2021
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

2 participants