Skip to content

Instantly share code, notes, and snippets.

@pramodjodhani
Last active April 4, 2024 06:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pramodjodhani/68b71cdaf29cd5ce554d9d54b8ee2424 to your computer and use it in GitHub Desktop.
Save pramodjodhani/68b71cdaf29cd5ce554d9d54b8ee2424 to your computer and use it in GitHub Desktop.
Flux - move the position of shipping section in classic theme
<?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