# Limit number of Tiers to 3

**URL:** <https://community.hivepress.io/t/limit-number-of-tiers-to-3/6776>\
**Category:** Marketplace\
**Tags:** marketplace, code\
**Created:** [July 27, 2023, 3:29pm UTC](https://community.hivepress.io/t/limit-number-of-tiers-to-3/6776 "2023-07-27T15:29:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kreeger](https://community.hivepress.io/letter_avatar_proxy/v4/letter/k/e68b1a/32.png) [@Kreeger](https://community.hivepress.io/u/Kreeger)\
**Post date:** [July 27, 2023, 3:29pm UTC](https://community.hivepress.io/t/limit-number-of-tiers-to-3/6776/1 "2023-07-27T15:29:07Z")

</div>

Hi,

I would like to limit the maximum allowed number of Tiers for a listing to 3.  
Ideally, I would like it to be impossible for the vendor to even create more than 3 tiers when submitting and updating a listing, but if it’s not possible, I would still like the form to show an error if the vendor tries to submit a listing with more than 3 levels of tiers.  
How can I achieve this?

Thank you very much!

---

<div class="post-metadata">

**Author:** ![yevhen](https://community.hivepress.io/user_avatar/community.hivepress.io/yevhen/32/23_2.png) [@yevhen](https://community.hivepress.io/u/yevhen)\
**Post date:** [July 28, 2023, 6:01pm UTC](https://community.hivepress.io/t/limit-number-of-tiers-to-3/6776/3 "2023-07-28T18:01:09Z")

</div>

Please try this PHP code snippet

```auto
add_filter( 
	'hivepress/v1/forms/listing_update/errors', 
	function ($errors, $form){
		if(count((array)$form->get_value('price_tiers')) > 3){
			$errors[] = 'Please set no more than three price tiers';
		}
		
		return $errors;
	},
	1000,
	2
);

```

---

<div class="post-metadata">

**Author:** ![Kreeger](https://community.hivepress.io/letter_avatar_proxy/v4/letter/k/e68b1a/32.png) [@Kreeger](https://community.hivepress.io/u/Kreeger)\
**Post date:** [July 31, 2023, 11:19am UTC](https://community.hivepress.io/t/limit-number-of-tiers-to-3/6776/4 "2023-07-31T11:19:29Z")

</div>

Than you, it works perfectly!

---

<div class="post-metadata">

**Author:** ![Kreeger](https://community.hivepress.io/letter_avatar_proxy/v4/letter/k/e68b1a/32.png) [@Kreeger](https://community.hivepress.io/u/Kreeger)\
**Post date:** [July 31, 2023, 11:54am UTC](https://community.hivepress.io/t/limit-number-of-tiers-to-3/6776/5 "2023-07-31T11:54:53Z")

</div>

Another question regarding the Tiers. How can I convert the ‘price\_tiers’ description fields to be a ‘textarea’ instead of a simple ‘text’ field?

---

<div class="post-metadata">

**Author:** ![andrii](https://community.hivepress.io/user_avatar/community.hivepress.io/andrii/32/2951_2.png) [@andrii](https://community.hivepress.io/u/andrii)\
**Post date:** [August 1, 2023, 6:41am UTC](https://community.hivepress.io/t/limit-number-of-tiers-to-3/6776/6 "2023-08-01T06:41:43Z")

</div>

Hi,

Please check this topic [Change price tiers' description field to textarea](https://community.hivepress.io/t/change-price-tiers-description-field-to-textarea/5564)

P.S. If you purchased a theme or extension, please enter the license key in the forum profile settings, this will enable the Premium Support badge and ensure a 24-hour turnaround time.

---

<div class="post-metadata">

**Author:** ![Kreeger](https://community.hivepress.io/letter_avatar_proxy/v4/letter/k/e68b1a/32.png) [@Kreeger](https://community.hivepress.io/u/Kreeger)\
**Post date:** [August 4, 2023, 9:41am UTC](https://community.hivepress.io/t/limit-number-of-tiers-to-3/6776/7 "2023-08-04T09:41:59Z")

</div>

Hi, thank you for the solution.  
About the Premium badge, I added my license keys yesterday and nothing happened. Is it possible the premium support is only valid for a certain period of time? Mine is older than a year.

---

<div class="post-metadata">

**Author:** ![andrii](https://community.hivepress.io/user_avatar/community.hivepress.io/andrii/32/2951_2.png) [@andrii](https://community.hivepress.io/u/andrii)\
**Post date:** [August 7, 2023, 1:09pm UTC](https://community.hivepress.io/t/limit-number-of-tiers-to-3/6776/10 "2023-08-07T13:09:21Z")

</div>

Hi,

I see. Since the license is valid for only one year, the easiest way is to purchase another product with a license if you need to renew it.

---

<div class="post-metadata">

**Author:** ![system](https://community.hivepress.io/user_avatar/community.hivepress.io/system/32/13990_2.png) [@system](https://community.hivepress.io/u/system)\
**Post date:** [September 6, 2023, 1:09pm UTC](https://community.hivepress.io/t/limit-number-of-tiers-to-3/6776/11 "2023-09-06T13:09:38Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
