Last active
April 4, 2024 06:55
-
-
Save pramodjodhani/68b71cdaf29cd5ce554d9d54b8ee2424 to your computer and use it in GitHub Desktop.
Flux - move the position of shipping section in classic theme
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 | |
/** | |
* Move shiping section for classic theme. | |
* | |
* @param array $step Step data. | |
* | |
* @return void | |
*/ | |
function move_shipping_section_after_shipping_address( $step ) { | |
if ( 'payment' === $step['slug'] ) { | |
?> | |
<tr> | |
<td colspan="2"> <table class='flux-shipping-container--desktop'></table> </td> | |
<td><div class="flux-checkout--modern"></div> </td> | |
</tr> | |
<?php | |
} | |
} | |
add_action( 'flux_before_step_content', 'move_shipping_section_after_shipping_address' ); | |
/** | |
* Flux checkout - change shipping row element to adjust for the classic theme. | |
*/ | |
add_action( 'wp_footer', function() { | |
if ( ! is_checkout() ) { | |
return; | |
} | |
?> | |
<script> | |
wp.hooks.addFilter( 'flux_checkout_move_shipping_row_element', 'flux_checkout', function( $shipping_row ) { | |
return jQuery('.flux-checkout__order-review tr.woocommerce-shipping-totals.shipping'); | |
}); | |
</script> | |
<?php | |
}, 10000 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment