Viewing 1 replies (of 1 total)
  • Plugin Author Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    Hmm, that is a possibility I suppose. It would get tricky as you need to target a specific shipping method. So with UPS, you’d need to choose which exact method.

    As an example, here is a short snippet for adding a cost onto FedEx Ground:

    function add_cost_to_shipping_rate( $rates, $package ) {
        $extra_cost  = '10';
    
        if ( isset( $rates['fedex:FEDEX_GROUND'] ) ) {
            $rate = $rates['fedex:FEDEX_GROUND'];
            $rate->cost = $rate->cost + $extra_cost;
        }
    
        return $rates;
    }
    add_filter( 'woocommerce_package_rates', 'add_cost_to_shipping_rate', 10, 2 );

    I don’t think this is something suitable for the plugin’s core code, but I can add in a filter to allow you to stop the fee from being added and use the cost of the fee in a custom snippet like the above to add to a shipping cost.

Viewing 1 replies (of 1 total)

The topic ‘Feature Request’ is closed to new replies.