How to get current listing object within a form?

Example code : add_filter(

  'hivepress/v1/forms/booking_confirm',
    function ( $form ) {
        $example_text = " - I'm testing";

            $form['fields']['_price']['label'] = esc_html__( 'Price: ' . $example_text , 'hivepress-bookings' );

        return $form;
    }
);

Hi,

Please provide more details, whether you need for booking or listing, and we will try to help.

I’m trying to implement a hourly booking model in Hivepress, basically slots in 3hrs, 6hrs, 9hrs with varying prices. Right now, I’m using price extras (created 3 slots) as a way to select an hourly slot for a booking. I’m doing this by making the default price of each listing $1 and the extras rate get added on to the final price.

Please let me know if there is more traditional/correct route to achieve this.

Coming to my query of how to get access to the $listing object inside a form filter, specifically the make booking form, details section. Doing this by editing the form code in the hivepress-booking plugin. I’m trying to refer to the github gists by unable to find one where the $listing object is used inside a form filter

I need to familiarise myself with accessing custom attribute values for a listing and attributes like price, extras prices and time of a listing to make further modifications

Hi,

We recommend using time slots of one hour each and enabling the Allow booking multiple time slots feature but note that there is no such thing as requiring 1, 3, or 6 hours. If you have a booked object, you can get the listing as follows $booking->get_listing(). Also, please note that you need to add the snippet code using this doc How to add custom code snippets - HivePress Help Center because all the changes you make directly in the theme will be automatically restored after our update.

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