woocommerce-rest-api-ts-lib icon indicating copy to clipboard operation
woocommerce-rest-api-ts-lib copied to clipboard

Paging does not work!

Open constantinosgeorgiou opened this issue 1 year ago • 4 comments

The way the current client is set up paging gets ignored due to the way the ProductsMainParams is defined.

export type ProductsMainParams = (ProductsParams & ProductsVariationsParams & ProductsAttributesParams) | ProductsAttributesTermsParams | ProductsCategoriesParams | ProductsShippingClassesParams | ProductsTagsParams | ProductsReviewsParams;

The ProductsParams contains the properties page and per_page, but the rest of the params do not.

Since paging works for product variations and product attributes, it is required to work for the rest of the endpoints.

Solution

Create a type intersection with either the ProductsParams type, or create a new type Paging.

constantinosgeorgiou avatar Sep 19 '23 10:09 constantinosgeorgiou