How to change price format

Hi there,

I’m still having problems displaying the “per hour” text for where the price is displayed on Listings. I was told to install Snippet Plugin and enter the following code:

add_filter(
	'hivepress/v1/models/listing/fields',
	function( $fields, $listing ) {
		if (hivepress()->get_version( 'bookings' ) && hivepress()->booking->is_time_enabled( $listing->get_id()) && isset( $fields['price'] ) ) {
			$fields['price']['display_template'] = '%value% / per Hour';
		}

		return $fields;
	},
	1000,
	2
);

This was completed and then the code snippet was added into the Price Attribute within Listings but it’s still not displaying the text or had any effect on what’s displayed - please see screenshots attached.

Any help would be greatly appreciated! Thank you, Sam.


Uploading: Screenshot 2023-01-17 at 20.58.05.png…

Hi,

Please refer to this topic Changed Price per Day to Price per Hour but it’s not working

Hi Andrii,

I’ve installed Code Snippet and entered the code that was given in other thread, unfortunately it’s still not working - are there any other solutions? Shall I hire a WordPress developer to take a look?

Thanks,
Sam

Hi,

If this Change the price display format for marketplace listings #hivepress #marketplace · GitHub PHP snippet didn’t work for you, please try this PHP snippet - Change the price display format for bookable listings #hivepress #listings #bookings · GitHub.

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