# Limit Loop Items per Customer Specification

**URL:** <https://forum.pinegrow.com/t/limit-loop-items-per-customer-specification/8451>\
**Category:** WooCommerce\
**Tags:** wordpress, blocks\
**Created:** [October 20, 2023, 12:35pm UTC](https://forum.pinegrow.com/t/limit-loop-items-per-customer-specification/8451 "2023-10-20T12:35:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![iamrobbie](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/iamrobbie/32/4694_2.png) [@iamrobbie](https://forum.pinegrow.com/u/iamrobbie)\
**Post date:** [October 20, 2023, 12:35pm UTC](https://forum.pinegrow.com/t/limit-loop-items-per-customer-specification/8451/1 "2023-10-20T12:35:08Z")

</div>

Hello,

I have created a Gutenberg Block for a WordPress website that contains a loop of repeated elements for all active WooCommerce Product Categories (using the PG WooCommerce `Show Categories’ Smart Action).

I would like to enable the website admin to limit the number of items that appear in the loop via the Block Editor in WordPress. Specifically, I’d like to create a field within the Block editor that allows the user to opt to display the number of categories in incremements of 3 (e.g., 3,6,9,12, or “Show All”).

Can I achieve this within PG, or do I need to wrestle with some custom code?

---

<div class="post-metadata">

**Author:** ![jonroc](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/jonroc/32/2805_2.png) [@jonroc](https://forum.pinegrow.com/u/jonroc)\
**Post date:** [October 20, 2023, 8:20pm UTC](https://forum.pinegrow.com/t/limit-loop-items-per-customer-specification/8451/2 "2023-10-20T20:20:07Z")

</div>

Hello,

I did something similar with the user selecting a category they want to use. You can take a look at this post and see if it would be a good solution for you to control the number of posts: [Passing Block Attribute Values to PHP Variables?](https://forum.pinegrow.com/t/passing-block-attribute-values-to-php-variables/7672)

---

<div class="post-metadata">

**Author:** ![matjaz](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/matjaz/32/5_2.png) [@matjaz](https://forum.pinegrow.com/u/matjaz)\
**Post date:** [October 23, 2023, 9:22am UTC](https://forum.pinegrow.com/t/limit-loop-items-per-customer-specification/8451/3 "2023-10-23T09:22:47Z")

</div>

@iamrobbie there is no easy way to do that at the moment.

Next release will add support for using dynamic block attributes in the field, for example:

 ![catsblockattr](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/4/4cf330a50571c2b4e31ba7a79aa03b2f148ba1eb.jpeg)

---

<div class="post-metadata">

**Author:** ![iamrobbie](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/iamrobbie/32/4694_2.png) [@iamrobbie](https://forum.pinegrow.com/u/iamrobbie)\
**Post date:** [October 27, 2023, 12:12pm UTC](https://forum.pinegrow.com/t/limit-loop-items-per-customer-specification/8451/4 "2023-10-27T12:12:08Z")

</div>

Hi, @jonroc. Thanks for this! Sorry for the late reply, my friend.

---

<div class="post-metadata">

**Author:** ![iamrobbie](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/iamrobbie/32/4694_2.png) [@iamrobbie](https://forum.pinegrow.com/u/iamrobbie)\
**Post date:** [October 27, 2023, 12:12pm UTC](https://forum.pinegrow.com/t/limit-loop-items-per-customer-specification/8451/5 "2023-10-27T12:12:51Z")

</div>

@matjaz - Woohoo! Awesome 🙂
