Woocommerce change default order [method - price] shipping en CART -
wc-cart-functions.php
function wc_cart_totals_shipping_method_label( $method ) { $label = $method->label; if ( $method->cost > 0 ) { 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>' . 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>' . wc()->countries->inc_tax_or_vat() . '</small>'; } } } elseif ( $method->id !== 'free_shipping' ) { $label .= ' (' . __( 'free', 'woocommerce' ) . ')'; } return apply_filters( 'woocommerce_cart_shipping_method_full_label', $label, $method ); }
the function returns $label
, $method
, want show $method
, $label
change order not possible
i want change order of [ price - shipping method] since system shows [ shipping method - price]
currently, checkout page looks this:
cart subtotal $300.00 shipping **ship international destination: $35.00** *change* order total $335.00
as change checkout page this;
cart subtotal $300.00 shipping , handling **$35.00 ship international destination** *change* order total $335.00
in
cart-shipping.php
i found solution, return of function, wp_kses_post( wc_cart_totals_shipping_method_label( $method ) ); used separator split function change order of appearance.
<?php if ( 1 === count( $available_methods ) ) : $method = current( $available_methods ); $leyenda=wp_kses_post( wc_cart_totals_shipping_method_label( $method ) ); $palabras=split(":","$leyenda"); echo "$palabras[1] $palabras[0]"; ?>
thank you
Comments
Post a Comment