skip to Main Content

Add 6% Surcharge to Shipping

add_filter( 'woocommerce_package_rates', 'add_shipping_percentage_surcharge', 10, 2 );
function add_shipping_percentage_surcharge( $rates, $package ) {

    foreach( $rates as $key => $value ) {
 
        if( $value->method_id == 'betrs_shipping' ) {
            $rates[ $key ]->cost += $rates[ $key ]->cost * 0.06;
        }
    }
 
    return $rates;
}
  • Was this article helpful ?
  • yesno
3 out of 3 visitors found this article helpful
Views: 67
Back To Top