Created
January 29, 2024 05:18
-
-
Save pramodjodhani/60d69c96e70b56bdc0b626bc8afbe856 to your computer and use it in GitHub Desktop.
Flux checkout - hide shipping section for details and address step.
This file contains 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 // do not include this line to functions.php | |
/** | |
* Flux checkout - hide shipping section for details and address step. | |
*/ | |
function flux_hide_shipping_section_for_details_address_step() { | |
if ( ! is_checkout() ) { | |
return; | |
} | |
?> | |
<script> | |
// call flux_add_step_class_to_wrapper on hash change and window load | |
jQuery( window ).on( 'hashchange load', function() { | |
flux_add_step_class_to_wrapper(); | |
} ); | |
function flux_add_step_class_to_wrapper() { | |
// get hash from url, remove # and add it to the wrapper (.flux-checkout__content) | |
var hash = window.location.hash; | |
if ( hash ) { | |
hash = hash.replace( '#', '' ); | |
jQuery( '.flux-checkout__content' ).removeClass( 'flux-active-step--details' ).removeClass( 'flux-active-step--payment' ).removeClass( 'flux-active-step--address' ); | |
jQuery( '.flux-checkout__content' ).addClass( 'flux-active-step--' + hash ); | |
} | |
} | |
</script> | |
<style> | |
.flux-active-step--details .flux-checkout__shipping-table, | |
.flux-active-step--address .flux-checkout__shipping-table{ | |
display: none; | |
} | |
</style> | |
<?php | |
} | |
add_action( 'wp_footer', 'flux_hide_shipping_section_for_details_address_step' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment