Limit number of Tiers to 3

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!

Please try this PHP code snippet

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
);
1 Like

Than you, it works perfectly!

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

Hi,

Please check this topic Change price tiers' description field to textarea

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.

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.

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.

1 Like

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