Hiding custom booking form fields on frontend

WordPress Event Management, Calendars & Registration Forums General Question Hiding custom booking form fields on frontend

This topic contains 3 replies, has 3 voices, and was last updated by  Andrew Shankie 8 years, 9 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #14919

    Hi.

    I am working on an integration between Woocommerce and Eventsorganiser Pro. For this purpose, I need to be able to show some information from Woocommerce to the admin only when the admin is viewing the booking (in the backend), but hide this information for users making the booking (in the frontend).

    Is there any way of hiding form fields on the booking form in the frontend only?

    Rgds,
    Dariusz

    Dariusz Miedzianogora
    #14928

    Hi Dariusz,

    No – but you can display information to the admin on the bookings admin page without adding it to the booking form at all.

    This simply involves registering a metabox:

    //Register metabox
    add_action( 'add_meta_boxes_event_page_bookings', 'my_register_bookings_metabox' );  
    function my_register_bookings_metabox(){
        add_meta_box( 'my-metabox-id', 'My Metabox', 'my_metabox_callback' );
    }
    
    //Metabox callback
    function my_metabox_callback( $booking ){
        echo "Metabox content for {$booking->ID}";
    }
    

    Details on add_meta_box() can be found here: http://codex.wordpress.org/Function_Reference/add_meta_box

    Stephen Harris
    #14932

    Ah yes, thank you.

    This works perfectly.

    Sometimes the simple solutions are the most difficult to see 😀

    Dariusz Miedzianogora
    #23003

    Hi Dariusz,

    Did you get anywhere with your Woocommerce/EO integration? We might need to build something similar and I was wondering if you had managed to get anything working.

    Cheers,

    Andrew

    Andrew Shankie
Viewing 4 posts - 1 through 4 (of 4 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.