List all products from Woocommerce

Hi! I am working with WooCommerce for a site and am wondering how to change the parameters for listing products.

Currently in frontity.settings.js i have the following:

          homepage: "/landing",
          postsPage: "/blog",
          postTypes: [
            {
              type: "product",
              endpoint: "product",
              archive: "/product",
              params: {
                per_page: 15,
                _embed: true,
              },
            },
          ],
          taxonomies: [
            {
              taxonomy: "product-category",
              endpoint: "/cocart/v1/products/categories/",
              postTypeEndpoint: "product",
              params: {
                per_page: 5,
                _embed: true,
              },
            },
          ],
          params: {
            per_page: 5,
            type: ["post", "page"],
          },

I am trying to set params for endpoint “product” so that i can retrieve 15 products instead of the default 5, however the params that i set right under endpoint “product” does not seem to be changing anything. i am using the following to console the items:

const data = state.source.get(state.router.link);
console.log(data.items);

But am still only getting 5 product items. What do i need to change to be able to get 15 like i am trying to set up in the params?

UPDATE:
I am trying to get 15 products for right now, but will end up needing to get all products.

1 Like

Hi @maddogdev,

Here you have some related threads that may help you with your issue:

1 Like

Hi @maddogdev !

You can have a look at this thread where we talk about the same problem and a workaround: Override 'per_page' per post-type

In fact, this is on our roadmap already: Source: Add params to postTypes

In short, we are aware that you cannot pass params to custom post types right now, I’m sorry!

However, we’d be more than happy to accept a pull request adding this feature! Let us know and I’d be happy to guide you! :slight_smile: