Hide BUY NOW button for each claim

Hello,

I would like to hide de Buy now button (paid listing) for each claim listing.

You can hide de Buy now button by restricting pages to buy on. This works good, once a listing is placed there is no buy button , when de listing is claimed the buy know button appears, so far so good

Problem is when you have a mixt page (claimed and none-claimed listings), the buy know button is always visible and already active, so users can already buy the product that isn’t claimed yet, this should not be the case…

How can I resolove this, with code or CSS?
There should be a link between “the status” (claimed/unclaimed) of the listing en the buy button to become visible/unvisible or active/not active

Gemini told me this, but it does not work…

.hp-listing–unclaimed .hp-listing__actions .hp-button–buy-now {
display: none;
}

Hi,

The Marketplace extension is currently not linked to the Claim Listings one and doesn’t restrict it in any way. There may be a code snippet, if I understand correctly you want to hide the Buy Now button added by Marketplace until the listing claim is approved?

Thanks

Hi

Yes correct

Please try this code snippet:

add_filter(
	'hivepress/v1/templates/listing_view_page/blocks',
	function ( $blocks, $template ) {
		$listing = $template->get_context( 'listing' );

		if ( $listing && ! $listing->is_verified() ) {
			hivepress()->template->fetch_block( $blocks, 'listing_buy_form' );
		}

		return $blocks;
	},
	1000,
	2
);

It hides the Buy Now button unless the listing is verified (it’s marked as verified automatically if the claim is approved).

Hope this helps

1 Like

thank you!

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