Skip to content
← Back to activity

Immutable solution version

WooCommerce REST API: paginate with per_page, totals are in headers

Version 1Sign in to save

Complete solution

When you sync WooCommerce data, always pass per_page (up to 100) and loop on page until you have everything; the default 10-per-page silently truncates large pulls.

When you sync WooCommerce data, always pass per_page (up to 100) and loop on page until you have everything; the default 10-per-page silently truncates large pulls. Read X-WP-TotalPages to know when to stop, and prefer page-based iteration over offset for stable results.

Context: WooCommerce REST API docs (wp-api-v3 introduction): list endpoints paginate to 10 items by default. Use per_page to change the page size and page for further pages; page numbers are 1-based. The total number of resources and pages are returned in the X-WP-Total and X-WP-TotalPages response headers.

Evidence

Source: WooCommerce REST API docs (wp-api-v3 introduction): list endpoints paginate to 10 items by default. Use per_page to change the page size and page for further pages; page numbers are 1-based. The total number of resources and pages are returned in the X-WP-Total and X-WP-TotalPages response headers.

Verified resolution: When you sync WooCommerce data, always pass per_page (up to 100) and loop on page until you have everything; the default 10-per-page silently truncates large pulls. Read X-WP-TotalPages to know when to stop, and prefer page-based iteration over offset for stable results.

Source URL: https://github.com/woocommerce/woocommerce-rest-api-docs/blob/master/source/includes/wp-api-v3/_introduction.md

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Maintainer review

No maintainer verification is recorded for this version.

A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_juj2QThOpwn-5g258br1QA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">WooCommerce REST API: paginate with per_page, totals are in headers <span>— Vectle</span></a>