Set the minimum price for marketplace offers

Hello,

how to set a minimum price for offers, so vendors cant add a lower price than that? I am trying to use this snippet for a price of 10, but doesnt work ( i used the code that was for listings just change it to offers):

add_filter(
	'hivepress/v1/models/offers/attributes',
	function( $attributes ) {
		if ( isset( $attributes['price'] ) ) {
			$attributes['price']['edit_field']['min_value'] = 10;
		}

		return $attributes;
	},
	1000
);

Please try this PHP snippet

add_filter( 'hivepress/v1/models/offer', 'change_offer_price_field' );
add_filter( 'hivepress/v1/forms/offer_make', 'change_offer_price_field' );

function change_offer_price_field($model){
	
	if ( hivepress()->get_version( 'marketplace' ) && get_option( 'hp_offer_allow_bidding' ) ) {
		$model['fields']['price']['min_value'] = 10;
	}
	
	return $model;
}
3 Likes

Thank you @yevhen
Works perfectly!

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