Created
October 14, 2024 05:59
-
-
Save kartikparmar/61901e9276a31d866dd7a35b9014584a to your computer and use it in GitHub Desktop.
To show the error notice before the booking form
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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