Free and Premium WordPress Plugins & Themes Forums WordPress Plugins Hotel Booking Customize a field in final checkout
- This topic has 15 replies, 2 voices, and was last updated 5 years, 4 months ago by J. Davis.
- AuthorPosts
- July 7, 2019 at 5:53 pm #825448Christine RosParticipant
Hello,
I wish to customize this
into this
I didn’t find to translate in Loco, and I want the field is required.
Is it possible ?
- This topic was modified 5 years, 4 months ago by Christine Ros.
July 8, 2019 at 8:24 am #825638J. DavisKeymasterHello Christine,
Thank you for your question however it is not still clear what section you want to edit. Could you provide a link to check this out? Thanks
best regards,
J. DavisJuly 8, 2019 at 5:30 pm #825919Christine RosParticipantHi Mr Davis,
I’d like to modify the thing in red rectangle of the first screen shot to look like in the second screenshot.At final checkout, on the page where there is the details of the payment and all about the customer, on the right of the screen, there is a field to add additional info optional.
I want to modify the text of the label from “note de commande” (order note in original english) into “heure d’arrivée” (check in time in original english)
I want to write in preset field “exemple: avant 13h30 / Après 13h30” instead of “comment about your order :ex delivery instruction”
And I want this field to be required because I need to know this information.
Thank you for help.
Christine
July 10, 2019 at 12:43 pm #826642J. DavisKeymasterHi Christine,
Thank you for your clarification. You will need to override default from with your modification using removing original function and adding new custom one. You may refer to one of the topics below to find examples of code to override the checkout form:
Or you may order this customization purchasing Extended Support offer. We will adjust the form for you.
best regards,
J. DavisJuly 14, 2019 at 4:03 pm #827784Christine RosParticipantHi,
Oh ! Now support is charged …By the way, I know the linked post – one of these is my last year post (free great answer).
I am not sure you well look at my question, because after 4 days searching in the all directories and files of the booking plugin, no way to find the thing i want to change : it is a woocommerce checkout field !
Also, I add .mphb-guest-name-wrapper{display:none;} in pethotel.child style.css, but it doesn’t override. This field still appears on checkout. Why ?
Thank for help (or do I have to pay for this ??)
July 15, 2019 at 3:14 pm #828140J. DavisKeymasterHi Christine,
Thank you for your feedback. As far as I know there are available free plugins that allow to edit WooCommerce Checkout page.
As for the style you try to implement so I’d recommend to add
!important
to force your style over the default one e.g..mphb-guest-name-wrapper{ display:none !important; }
We still provide support for free if one owns active license however the custom modifications requires more time and efforts and are not included in default support policy. So we provide you with a solution however if you want us to implement it you may order Extended Support service additionally to get qualified personal assistance.
best regards,
J. DavisJuly 15, 2019 at 4:45 pm #828146Christine RosParticipantHello Mr Davis,
Glad to ear from you. I understand your point of view about customization.
Now, I also know plugins to edit woocommerce checkout, maybe you could answered the field i’d like to change was handled by WC, not to override function.
The adding important! in the code doesn’t works.
Thanks for help.
July 16, 2019 at 2:22 pm #828433J. DavisKeymasterHi Christine,
Thank you for your reply. I’ve checked your site and found that it was field at WooCommerce Checkout page and it looks like you have modified it.
Additionally I could not see guest name field on booking confirmation page. have you managed to remove it?
best regards,
J. DavisJuly 16, 2019 at 3:27 pm #828454Christine RosParticipantHi,
I have installed a plugin to change the text in the field showed on the screen shot above. Also, this plugin make me able to add a field about arrival time.
To remove guest name on motopress booking plugin, I had to modify checkout-view.php – I have deleted line from 180 to 188.
To protect the customization from plugin update, I first tryed to add directories in Petotel Child Theme : includes\views\shortcodes\checkout-view.php. But, maybe it is not the right way because guest wrapper still appear on the info checkout page, so i have deleted the additional files on child theme, and make change in original checkout-view.php.
Is there a better way to protect from update ?July 18, 2019 at 2:33 pm #829332J. DavisKeymasterHi Christine,
The easiest way to remove that field was to use a style I sent. However if you wish to remove it overriding templates of Hotel Booking plugin you will need to add remove default function and add your custom one e.g.
add_action( 'wp_head', 'remove_my_class_action' ); function remove_my_class_action(){ remove_action( 'mphb_sc_checkout_room_details', array( '\MPHB\Views\Shortcodes\CheckoutView', 'renderGuestsChooser' ), 20, 3 ); } add_action( 'mphb_sc_checkout_room_details', 'theme_renderGuestsChooser' , 20, 3 ); function theme_renderGuestsChooser( $roomType, $roomIndex, $booking ){ $namePrefix = 'mphb_room_details[' . esc_attr( $roomIndex ) . ']'; $idPrefix = 'mphb_room_details-' . esc_attr( $roomIndex ); $maxAdults = $roomType->getAdultsCapacity(); $maxChildren = $roomType->getChildrenCapacity(); ?> <?php if ( MPHB()->settings()->main()->isAdultsAllowed() ) { ?> <p class="mphb-adults-chooser"> <label for="<?php echo esc_attr( $idPrefix . '-adults' ); ?>"> <?php if ( MPHB()->settings()->main()->isChildrenAllowed() ) { _e( 'Adults', 'motopress-hotel-booking' ); } else { _e( 'Guests', 'motopress-hotel-booking' ); } ?> <abbr title="<?php _e( 'Required', 'motopress-hotel-booking' ); ?>">*</abbr> </label> <select name="<?php echo esc_attr( $namePrefix . '[adults]' ); ?>" id="<?php echo esc_attr( $idPrefix . '-adults' ); ?>" class="mphb_sc_checkout-guests-chooser mphb_checkout-guests-chooser" required="required"> <option value=""><?php _e( '— Select —', 'motopress-hotel-booking' ); ?></option> <?php for ( $i = 1; $i <= $maxAdults; $i++ ) { ?> <option value="<?php echo $i; ?>"> <?php echo $i; ?> </option> <?php } ?> </select> </p> <?php } else { ?> <input type="hidden" id="<?php echo esc_attr( $idPrefix . '-adults' ); ?>" name="<?php echo esc_attr( $namePrefix . '[adults]' ); ?>" value="<?php echo esc_attr( $maxAdults ); ?>" /> <?php } ?> <?php if ( $roomType->getChildrenCapacity() > 0 && MPHB()->settings()->main()->isChildrenAllowed() ) { ?> <p class="mphb-children-chooser"> <label for="<?php echo esc_attr( $idPrefix . '-children' ); ?>"> <?php printf( __( 'Children %s', 'motopress-hotel-booking' ), MPHB()->settings()->main()->getChildrenAgeText() ); ?> <abbr title="<?php _e( 'Required', 'motopress-hotel-booking' ); ?>">*</abbr> </label> <select name="<?php echo esc_attr( $namePrefix . '[children]' ); ?>" id="<?php echo esc_attr( $idPrefix . '-children' ); ?>" class="mphb_sc_checkout-guests-chooser mphb_checkout-guests-chooser" required="required"> <option value=""><?php _e( '— Select —', 'motopress-hotel-booking' ); ?></option> <?php for ( $i = 0; $i <= $maxChildren; $i++ ) { ?> <option value="<?php echo $i; ?>"> <?php echo $i; ?> </option> <?php } ?> </select> </p> <?php } else { ?> <input type="hidden" id="<?php echo esc_attr( $idPrefix . '-children' ); ?>" name="<?php echo esc_attr( $namePrefix . '[children]' ); ?>" value="<?php echo esc_attr( $maxChildren ); ?>" /> <?php } ?> <!--<p class="mphb-guest-name-wrapper"> <label for="<?php echo esc_attr( $idPrefix . '-guest-name' ); ?>"> <?php _e( 'Full Guest Name', 'motopress-hotel-booking' ); ?> </label> <input type="text" name="<?php echo esc_attr( $namePrefix . '[guest_name]' ); ?>" id="<?php echo esc_attr( $idPrefix . '-guest-name' ); ?>" /> </p>--> <?php }
This code should be added to functions.php file of the Child Theme.
best regards,
J. DavisJuly 19, 2019 at 9:40 am #829741Christine RosParticipantHello M.Davis
As I told you, adding code in css.file + important! didn’t works.
I have edited function.php child theme as you kindly explain to me, instead of delete lines of code in checkout-view.php and it is ok too, i’ve tried to code something like you did, but as i am not a master in php, i certainly made something (s) wrong. So thank you a hundred times for your help.
Have a very good day.July 19, 2019 at 9:51 am #829745J. DavisKeymasterHi Christine,
Thank you for your reply.
1. As for css I meant that I could check why the style did not work if you remove modifications however it is noted any more if it work with function code I’ve sent.
2. Do you mean the code I sent works properly or you still need some modifications?
best regards,
J. DavisJuly 19, 2019 at 11:19 am #829797Christine RosParticipantHi,
2 – I mean your code works great, mine was not good coded
1 – ok, i understand. Do you want me to restore function.php child theme to check why css doesn’t works ?
July 19, 2019 at 12:29 pm #829861J. DavisKeymasterHi Christine,
1. We just want to help you resolve the question you have. If you are satisfied with function code that removed guest name field we may leave it as it is. However if you insist to resolve this request by means of CSS we may proceed in this direction. Thanks.
best regards,
J. DavisJuly 19, 2019 at 4:56 pm #830024Christine RosParticipantHello again,
My problem is solved, I am very happy with the result.
Thank you again.
Christine - AuthorPosts
- You must be logged in to reply to this topic.