generate functionMon, 26 Dec 2022

show shipping costs in woocommerce checkout summary

function custom_woocommerce_cart_shipping_method_full_label( $label, $method ) { $label .= ': '; if ( WC()->cart->tax_display_cart == 'excl' ) { $label .= wc_price( $method->cost ); if ( $method->get_shipping_tax() > 0 && WC()->cart->prices_include_tax ) { $label .= ' <small class="tax_label">' . WC()->countries->ex_tax_or_vat() . '</small>'; } } else { $label .= wc_price( $method->cost + $method->get_shipping_tax() ); if ( $method->get_shipping_tax() > 0 && ! WC()->cart->prices_include_tax ) { $label .= ' <small class="tax_label">' . WC()->countries->inc_tax_or_vat() . '</small>'; }

Questions about programming?Chat with your personal AI assistant