Skip to content

Instantly share code, notes, and snippets.

@liranop
Last active August 11, 2023 05:58
Show Gist options
  • Save liranop/c068c0b84343f0743f8700c30fa44cd9 to your computer and use it in GitHub Desktop.
Save liranop/c068c0b84343f0743f8700c30fa44cd9 to your computer and use it in GitHub Desktop.
Make shipping row in woocommerce cart and checkout to full width
/**
* @snippet Expend WooCommerce Shipping Row in Cart and Checkout
*/
add_action( 'wp_footer', 'expend_shipping_row_jscript', 9999 );
function expend_shipping_row_jscript() {
if ( is_cart() || is_checkout() && empty( $wp->query_vars['order-pay'] ) && ! isset( $wp->query_vars['order-received'] ) ) {
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('table.shop_table tr.shipping > td ').attr('colspan',2);
$( 'body' ).on( 'updated_checkout', function() {
$('table.shop_table tr.shipping > td ').attr('colspan',2);
});
});
</script>
<?php }
}
tr.shipping th {
display:none
}
tr.shipping td:before {
content: attr(data-title);
font-weight: bold;
display: block;
margin-bottom: 10px;
}
@liranop
Copy link
Author

liranop commented Oct 10, 2022

before image: before
after image: after

@smtylmz89
Copy link

smtylmz89 commented Oct 11, 2022

Good work! I keep it for later :)

@jakubkasparek
Copy link

Nice. Thanks:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment