Make all listings quantity the same

Hi. I would like to make every listing a single purchase. I enabled the Allow seller to limit quantity field and it works good if quantity is 1, after purchasing the item it is removed from active listings. But I do not want this options open to users, every single items must be a new listing. How can I make quantity default to 1 and hide field from users?

Thank you!

Please try this PHP snippet, it hides the Quantity field and sets it to 1 for new listings:

	function( $attributes ) {
		if ( isset( $attributes['quantity'] ) ) {
			$attributes['quantity']['editable'] = false;
		return $attributes;

add_action('hivepress/v1/models/listing/create', function($listing_id) {
	update_post_meta($listing_id, 'hp_quantity', '1');
1 Like

Hi apologies for reply so late. I tried the snippet and it worked perfectly!!!

Thank you very much man!

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