Hello!
A couple of weeks ago one of you provided the following code snippet for hiding the $0 price and the “book now” button on non-bookable categories. The issues I’ve discovered is that this snippet also hides the ability to filter for price in the menu on the search page.
Basically users can no longer filter places by price. Any thoughts on how I might modify the snippet so that it still hides the price on non-bookable categories but lets the rest of my listings be filterable by price (because majority of my listings have prices)?
Here’s the snippet:
add_filter(
'hivepress/v1/models/listing/attributes',
function( $attributes ) {
$category_ids = [86,89,24,100,104,126,50,14,49,29];
if ( isset( $attributes['price'] ) ) {
$attributes['price']['categories'] = $category_ids;
}
if ( isset( $attributes['booking_offset'] ) ) {
foreach ( $attributes as $name => $args ) {
if ( strpos( $name, 'booking' ) === 0 ) {
$attributes[ $name ]['categories'] = $category_ids;
}
}
}
return $attributes;
},
1000
);