Is it possible to add text to price attribute only on a Listing block, but that same text won't show up after the price on the Listing page?

I used the below snippet to add the words “per 30 minutes” after the price attribute on my Listings. This works great on the Listing blocks. However, when I click through to the Listing page and add timeslots to be purchased, it multiplies the price by the number of timeslots I selected. For example: If a Listing costs $50 per 30 minutes, and I choose 2 timeslots, the price on the Listing page will visually update to show “$100 per 30 minutes,”

So it it possible to only have that wording show on the Listing block? And then on the Listing page I can have different wording showing like “Total Price”?

> add_filter(
> 	'hivepress/v1/models/listing/fields',
> 	function( $fields, $model ) {
> 		if ( isset( $fields['price'] ) ) {
> 			$fields['price']['display_template'] = '%value% per 30 minutes';
> 		}
> 
> 		return $fields;
> 	},
> 	1000,
> 	2
> );

Yes, it’s possible but requires further customizations. If you’re familiar with code basics please try using the hivepress/v1/templates/listing_view_block filter hook instead.

Are you able to send the full PHP code snippet for this one? I tried to add this in but it didn’t work.

Hi,

Sorry for the inconvenience, but customization is beyond our support scope - it includes fixing bugs and guidance about the available features Support Policy | HivePress

If customizations are required for your site, please try customizing it using the collection of code snippets Search · user:hivepress · GitHub and other developer resources, or consider hiring someone for custom work https://fvrr.co/32e7LvY

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