How can you mark a listing as sold?

Am I missing something obvious? I can’t find a way in RentalHive for the vendor or admin to mark a listing as “sold” or “unavailable”.

I can delete the listing, but for SEO purposes and general user experience, I would like to keep the pages live, just marked as sold.

For example, user finds old listing link on facebook, clicks the link, lands on a “sold” page", looks at similar listings.

I see a dropdown in the listing settings for “expiration”, but most of my example listings are several months past the expired date and they still appear on the site as normal, so I’m unsure what the expiration does.

Hi,
You can try to add a custom checkbox attribute in Listings > Attributes (example - <span class="hp-status hp-status--draft">Sold</span>). Then in the listing form, you can mark the Sold, and it will be displayed with a label on the listing page, for example (if you select this display area).

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

1 Like

Thanks @andrii

So just to make sure, there’s not a feature built into Hivepress RentalHive to allow for listings to be marked as sold or inactive? They just persist until the user or admin deletes the listing?

Yes, the theme itself is a rental marketplace (for any type of listings, not just properties - for example equipment, services, anything bookable) so there’s no hard-coded Sold attribute for listings, but you can add it as a custom listing attribute of Checkbox type and display it on the listing page (or in the listing preview), this will keep the listing page visible but will not exclude it from search by default. If the listing page can be hidden, then there may be a workaround if hosts use the Hide/Unhide link to change the listing visibility.

Thanks for the response @ihor.

How do other Hivepress themes handle this? Does ListingHive have the ability to mark something as sold?

I’d like to see a current theme with this feature to see the user experience.

ListingHive is powered by the same HivePress framework (RentalHive includes extra extensions like Bookings and Marketplace) so the basic functionality is the same - a custom attribute is required for adding a Sold status, you can add a Checkbox attribute for this and style it in any way (as a workaround for the built-in Sold status).

The suggested solution of using an attribute checkbox might work. I tried that and styled a little “sold” attribute in the sidebar.

Is there a way to hide the price on the sold pages that have the sold attribute checked? In the screenshot below, it would be ideal to not display the price and just display the “SOLD” attribute.

Hi,
Please try this PHP snippet:

add_filter(
 'hivepress/v1/fields/number/display_value',
 function( $value, $field ) {
  if ( $field->get_name() === 'price' ) {
   $listing = $field->get_context( 'listing' );

   if ( $listing && $listing->is_sold() ) {
    $value = null;
   }
  }

  return $value;
 },
 1000,
 2
);

Thanks @andrii. That worked as expected by removing the price.

But I added a $ symbol in front of the price in the listing attribute:

So the code snippet remove the price attribute but left the $ symbol:

Please try this code snippet instead:

add_action(
	'wp_head',
	function() {
		if ( is_singular( 'hp_listing' ) ) {
			$listing = hivepress()->request->get_context( 'listing' );

			if ( $listing && $listing->is_sold() ) {
				echo '<style>.hp-page__sidebar .hp-listing__attribute--price{display:none}</style>';
			}
		}
	}
);

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