Answer the question
In order to leave comments, you need to log in
How to create a simple product through the woocommerce API (python)?
This is my first time working with the API, so I need help. Much is not required, you just need to create a product with your own: name, price and picture. I read the documentation, but did not fully understand it, it would be nice to see an example of a ready-made code for creating a product.
Answer the question
In order to leave comments, you need to log in
Hello!
I worked with WC through Java, but the principle is the same.
1) Get a token in the admin panel for subsequent authorization.
2) Code snippets for work are provided at the office. WC site
https://woocommerce.github.io/woocommerce-rest-api...
There are snippets for Python too.
For example authorization:
from urllib.parse import urlencode
store_url = 'http://example.com'
endpoint = '/wc-auth/v1/authorize'
params = {
"app_name": "My App Name",
"scope": "read_write",
"user_id": 123,
"return_url": "http://app.com/return-page",
"callback_url": "https://app.com/callback-endpoint"
}
query_string = urlencode(params)
print("%s%s?%s" % (store_url, endpoint, query_string))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question