skip to Main Content
IMPORTANT
Due to personal health issues there is currently a delay in support response time.
I greatly apologize for this inconvenience and will respond to each ticket as soon as I can.

Have different minimum amounts

The following example uses different minimum amounts depending on the option available. This is useful when you have percentage based costs but require a different minimum amount for each.

add_filter( 'woocommerce_package_rates', 'modify_shipping_option_minimum', 10, 2 );
function modify_shipping_option_minimum( $rates, $package ) {
    // retrieve number of items in the cart
    $subtotal = $package['contents_cost'];

    foreach( $rates as $key => $rate ) {
        if( $rate->id == 'table_rate_shipping_standard' && $subtotal < 8.00 ) {
            $rates[ $key ]->cost = 8.00;
        } elseif( $rate->id == 'table_rate_shipping_priority' && $subtotal < 12.50 ) {
            $rates[ $key ]->cost = 12.50;
        } elseif( $rate->id == 'table_rate_shipping_expedited' && $subtotal < 14.99 ) {
            $rates[ $key ]->cost = 14.99;
        }
    }
  
    return $rates;
}
  • Was this article helpful ?
  • yesno
0 out of 0 visitors found this article helpful
Views: 91
Back To Top