“shipping class cost” seems not working.
-
Hello
I am trying to use the shipping class. To test it, i set it up as this:
https://ibb.co/4fWBmhbHowever, after typing in the shipping address, the total amount of shipping in my “check-out order table” (usually shown at https://www.mystore.com/checkout/) accounts only for the flat-rate “Cost”, which is the third input in the screenshot, but NONE of those amounts for “shipping class cost” was calculated. The total shipping amount simply ignores any shipping class cost, even though the product belongs to one of the shipping classes.
So, in this file, ../wp-content/plugins/woocommerce/includes/wc-cart-functions.php, I can see a function wc_cart_totals_shipping_method_label( $method ), and this function actually printed out this total shipping amount.
In there, I think “$method->cost” represents the shipping cost for a flat-rate. Isn’t this accounts only for the flat-rate’s cost? (which is 5*[qty])I do not see that any of the ‘class_cost_’.$shipping_class was included to compute the total shipping amount. Am i missing something?
The version of woocommerce i am using is 3.5.7.function wc_cart_totals_shipping_method_label( $method ) {
$label = $method->get_label();
$has_cost = 0 < $method->cost;
$hide_cost = ! $has_cost && in_array( $method->get_method_id(), array( ‘free_shipping’, ‘local_pickup’ ), true );if ( $has_cost && ! $hide_cost ) {
if ( WC()->cart->display_prices_including_tax() ) {
$label .= ‘: ‘ . wc_price( $method->cost + $method->get_shipping_tax() );
if ( $method->get_shipping_tax() > 0 && ! wc_prices_include_tax() ) {
$label .= ‘ <small class=”tax_label”>’ . WC()->countries->inc_tax_or_vat() . ‘</small>’;
}
} else {
$label .= ‘: ‘ . wc_price( $method->cost );
if ( $method->get_shipping_tax() > 0 && wc_prices_include_tax() ) {
$label .= ‘ <small class=”tax_label”>’ . WC()->countries->ex_tax_or_vat() . ‘</small>’;
}
}
}
- The topic ‘“shipping class cost” seems not working.’ is closed to new replies.