Monday, 24 August 2020

WooCommerce - How to edit per product shipping label/price

I'm using the below function to show the shipping price as 0.00 instead of blank when the shipping is free and it works great at order level (originally taken from here):

add_filter( 'woocommerce_cart_shipping_method_full_label', 'add_0_to_shipping_label', 10, 2 );
function add_0_to_shipping_label( $label, $method ) {
    if ( ! ( $method->cost > 0 ) ) {
    $label .= ': ' . wc_price(0);
    } 
 return $label;
}

However this only works for the standard order shipping methods i.e. when there is only one product on the order and shipping is added at order level.

I'm using a third party plugin which adds per-product shipping options when there is more than one product in the order. However, the plugin files are encrypted with IonCube loader so I cannot view or edit them.

Is there a generic way I can also make the above function work for per-product shipping as well (essentially, for all shipping methods, per product shipping methods, fees etc. regardless of how they are created)?

Or do I need to wait for the plugin developers to add the feature, which they are not keen on doing (so could be a very long wait)?

Thanks



from WooCommerce - How to edit per product shipping label/price

No comments:

Post a Comment