Loop products and limit products with the same name to 3

Highlighted
New Member
1 0 0

I have a collection page and items that share the same name.

I need to loop through each product and limit the product to 3 items that share the same name.

Example: I only want to show 3 items that have the same name.

Current Products showing on Collection:

- Black - Black - Black - Black - Black

- Red - Red - Red - Red - Red

- Orange - Orange

- Yellow - Yellow - Yellow - Yellow - Yellow - Yellow

- Brown - Brown - Brown - Brown - Brown

- Blue - Blue - Blue - Blue - Blue - Blue - Blue - Blue - Blue


What I want to show on the collection, is only 3 items with the same name not all

- Black - Black - Black

- Red - Red - Red

- Orange - Orange

- Yellow - Yellow - Yellow

- Brown - Brown - Brown

- Blue - Blue - Blue

0 Likes