-
Notifications
You must be signed in to change notification settings - Fork 113
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
product-variations #102
Comments
I saw this on the docs but I don't know how to set this param in the request.when I use this code def get_product_variations(self, product_id,max_number_of_variations):
try:
max_number_of_variations = int(max_number_of_variations)
print(f"\nproducts/{product_id}/variations?per_page={max_number_of_variations}")
res = self.wcapi.get(f"products/{product_id}/variations?per_page={max_number_of_variations}").json()
self.data = res
return res
except Exception as e:
raise RuntimeError(f"Error: Failed to retrieve variations for product ID {product_id}. Details: {e}") I got this response {
"code": "rest_invalid_param",
"message": "Invalid parameter(s): per_page",
"data": {
"status": 400,
"params": {
"per_page": "per_page is not of type integer."
},
"details": {
"per_page": {
"code": "rest_invalid_type",
"message": "per_page is not of type integer.",
"data": {
"param": "per_page"
}
}
}
}
} what should I do? |
this said on the docs Requests that return multiple items will be paginated to 10 items by default. This default can be changed by the site administrator by changing the posts_per_page option. Alternatively the items per page can be specified with the ?per_page parameter: GET /orders?per_page=15 You can specify further pages with the ?page parameter: GET /orders?page=2 You may also specify the offset from the first resource using the ?offset parameter: GET /orders?offset=5 Page number is 1-based and omitting the ?page parameter will return the first page. The total number of resources and pages are always included in the X-WP-Total and X-WP-TotalPages HTTP headers. but how? |
when i call this
/wp-json/wc/v3/products/<product_id>/variations
to List all product variations it's won't return the list that is bigger than 10 and just return the first then of the variation of the productwhat should I do?
The text was updated successfully, but these errors were encountered: