Skip to content

Instantly share code, notes, and snippets.

@kartikparmar
Created October 14, 2024 05:59
Show Gist options
  • Save kartikparmar/61901e9276a31d866dd7a35b9014584a to your computer and use it in GitHub Desktop.
Save kartikparmar/61901e9276a31d866dd7a35b9014584a to your computer and use it in GitHub Desktop.
To show the error notice before the booking form
<?php
// Function to enqueue the custom script to move WooCommerce Error Notices
function bkap_move_woocommerce_notices_above_booking_form() {
if ( is_product() ) {
?>
<script>
jQuery(document).ready(function($) {
var wooNotices = $('.woocommerce-error');
if ( wooNotices.length && $('.bkap-booking-form').length ) {
// Move the notices to the correct location (above booking form)
wooNotices.insertBefore('.bkap-booking-form'); // Adjust if needed
}
});
</script>
<?php
}
}
add_action( 'wp_footer', 'bkap_move_woocommerce_notices_above_booking_form' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment