woocommerce / woocommerce/wc-api-python

Issue using POST to batch update products

Open
#85 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
216
Forks
108
Avg merge
6h 34m
Merged PRs (30d)
1

Description

I am attempting to batch update prices for products, this is just a small example to test updating using the batch method:
When I swap the POST for PUT I get a 200, but nothing gets updated

`wcapi = WCAPI(
url=site_url,
consumer_key=wc_ck,
consumer_secret=wc_sk,
wp_api=True,
version="wc/v3",
query_string_auth=True
)

test_json = {
"update": [
{
"id": 1675,
"price": "8042.0",
"regular_price": "8042.0"
}
]
}

print(wcapi.post("products/batch", test_json).json())`

This returns a 404:
{'code': 'rest_no_route', 'message': 'No route was found matching the URL and request method.', 'data': {'status': 404}}

However, when I use get in something like this it works just fine and returns products
wcapi.get("products").json()

My API key is read/write enabled.

Any help is appreciated. Thanks

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the WCAPI.post call shown in the issue and compare its request construction with WCAPI.get. Then check how the WooCommerce wc/v3 products/batch endpoint handles POST and PUT requests. Done means identifying whether the failure is in the wrapper or endpoint usage and documenting or correcting the supported request path.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.