Answers.Body: <p><code>product.variants</code> returns the variants for the product as an array only. It is not like a element relationship field which returns an element query.</p>
  
  <p>If you want to use a element query of variants for a particular product you can do:</p>
  
  <p><code>craft.variants.product(product).all</code></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-17T18:40:06.043Z
Answers.Text: To complete Luke's answer, omit the `.all()` call here, and pass the main `VariantQuery` object to the `paginate` template tag: `{% paginate craft.variants({ product: product }) as pageInfo, pageVariants %}` (Otherwise, you're back at square one, with a simple array!)
Answers.UserDisplayName: August Miller
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-19T12:13:51.340Z
Answers.Text: Thanks both. @AugustMiller your tag worked perfectly. Thanks!
Answers.UserDisplayName: Jay
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-19T16:36:05.003Z
Answers.Text: I ended up going with `{% paginate craft.variants({ product: product }).limit(12) as pageInfo, pageVariants %}` to get the pagination to work properly by the way. :)
Answers.UserDisplayName: Jay
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-17T03:02:48.400Z
Answers.LastActivityDate: 2018-12-17T03:02:48.400Z
Answers.UserDisplayName: Luke Holder
Answers.Body: <p>I'm interested how you are calling <code>variants</code> - have you tried using <code>craft.variants.limit(12)</code> versus <code>variants.limit(12)</code>? <a href="https://docs.craftcms.com/commerce/v2/dev/element-queries/variant-queries.html#example" rel="nofollow noreferrer">Craft Docs - sample variant query</a></p>
  
  <p><a href="https://craftcms.stackexchange.com/questions/781/paginate-an-array-of-entries">Here</a> is another example where Brad shares insights on paginating after using the search service.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-14T12:30:17.130Z
Answers.Text: Updated question.
Answers.UserDisplayName: Jay
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-14T02:37:14.537Z
Answers.LastActivityDate: 2018-12-14T02:54:38.507Z
Answers.LastEditDate: 2018-12-14T02:54:38.507Z
Answers.UserDisplayName: Jessie Gilligan
Body: <p>I am currently in the process of building a commerce 2 site with a very detailed level of nesting in the product options so we're looking to list all variants for a product. (Sounds silly, but it works in this case!)</p>
  
  <p>However, while trying to use paginate, I'm getting the following error:</p>
  
  <pre><code>Impossible to invoke a method ("limit") on an array.
  </code></pre>
  
  <p>Here is my markup:</p>
  
  <pre><code>{% paginate variants.limit(12) as pageInfo, pageEntries %}
  </code></pre>
  
  <p>Is it even possible to paginate variants?</p>
  
  <p>Thanks</p>
  
  <p>EDIT</p>
  
  <p>We are getting all the product variants as follows:</p>
  
  <pre><code>{% set variants = product.variants %}
  </code></pre>
  
  <p>But if we use the limit here outside of the pagination, won't that mean we will always get the same first 12 items. Whereas we need to limit it within the paginator so we get the first 12, the next 12 etc etc.</p>
  
  <p>Cheers</p>
  
Tags: <plugin-craftcommerce><loop><plugin-craftcommerce2><paginate>
Title: Possible to paginate product variants in Craft Commerce 2?
ThreadText: # Possible to paginate product variants in Craft Commerce 2?
  
  (Asked by: username_0 on 2018-12-13)
  
  I am currently in the process of building a commerce 2 site with a very detailed level of nesting in the product options so we're looking to list all variants for a product. (Sounds silly, but it works in this case!)
  
  However, while trying to use paginate, I'm getting the following error:
  
  ```
  Impossible to invoke a method ("limit") on an array.
  
  ```
  
  Here is my markup:
  
  ```
  {% paginate variants.limit(12) as pageInfo, pageEntries %}
  
  ```
  
  Is it even possible to paginate variants?
  
  Thanks
  
  EDIT
  
  We are getting all the product variants as follows:
  
  ```
  {% set variants = product.variants %}
  
  ```
  
  But if we use the limit here outside of the pagination, won't that mean we will always get the same first 12 items. Whereas we need to limit it within the paginator so we get the first 12, the next 12 etc etc.
  
  Cheers
  
  **Tags:** plugin-craftcommerce, loop, plugin-craftcommerce2, paginate
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2018-12-17. Score: 3 | Accepted answer
  
  `product.variants` returns the variants for the product as an array only. It is not like a element relationship field which returns an element query.
  
  If you want to use a element query of variants for a particular product you can do:
  
  `craft.variants.product(product).all`
  
  > **Comments:**
  > **username_2**: To complete username_1's answer, omit the `.all()` call here, and pass the main `VariantQuery` object to the `paginate` template tag: `{% paginate craft.variants({ product: product }) as pageInfo, pageVariants %}` (Otherwise, you're back at square one, with a simple array!)  
  > **username_0**: Thanks both. @username_2 your tag worked perfectly. Thanks!  
  > **username_0**: I ended up going with `{% paginate craft.variants({ product: product }).limit(12) as pageInfo, pageVariants %}` to get the pagination to work properly by the way. :)  
  
  ---
  
  ### Answer by username_3 on 2018-12-14. Score: 1
  
  I'm interested how you are calling `variants` - have you tried using `craft.variants.limit(12)` versus `variants.limit(12)`? [Craft Docs - sample variant query](https://docs.craftcms.com/commerce/v2/dev/element-queries/variant-queries.html#example)
  
  [Here](https://craftcms.stackexchange.com/questions/781/paginate-an-array-of-entries) is another example where Brad shares insights on paginating after using the search service.
  
  > **Comments:**
  > **username_0**: Updated question.  
  
  ---
  
  