Skip to content

Instantly share code, notes, and snippets.

@pramodjodhani
Last active March 4, 2024 05:20
Show Gist options
  • Save pramodjodhani/244f4f0acc8b514cd803cce99bb6579b to your computer and use it in GitHub Desktop.
Save pramodjodhani/244f4f0acc8b514cd803cce99bb6579b to your computer and use it in GitHub Desktop.
Add shipping cost row to the checkout page
<?php
add_action(
'woocommerce_review_order_before_order_total',
function() {
if ( empty( WC()->cart->get_shipping_total() ) ) {
return;
}
echo sprintf( '<tr class="fee orderable-shipping-row"><th>%s</th><td>%s</td></tr>', esc_html__( 'Shipping', 'flux-checkout' ), wc_price( WC()->cart->get_shipping_total() ) );
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment