Skip to content

Commit

Permalink
Adds example for page length and page number
Browse files Browse the repository at this point in the history
There wan't an example for listing products for pagination (Issue #121). This change adds an example for it.
  • Loading branch information
sanketnaik99 authored Aug 7, 2022
1 parent 591b3f3 commit c82a6ec
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/01_Products.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,19 @@ commerce.products.list({
}).then(response => response.data); // Returns all products sorted by highest price first.
```

Example request listing products for pagination:

```js
import Commerce from '@chec/commerce.js';

const commerce = new Commerce('{your_public_key}');

commerce.products.list({
limit: 20,
page: 1, // The page number defaults to 1 if it is not specified
}).then(response => response.data); // Returns 20 products for page 1
```

Once you've got your product data you can populate your product listing view. The response here will include everything
you need to build this view, such as metadata, assets, variant groups and variant options, conditionals, and prices.

Expand Down

0 comments on commit c82a6ec

Please sign in to comment.