• Casper

    (@reycasper21)


    Hi i would like to ask if its possible to setup a minimum order in woocommerce based on the shipping method. I have flat rate and store pick up, but each should have its own minimum order.

Viewing 1 replies (of 1 total)
  • Thread Starter Casper

    (@reycasper21)

    I try this code buy seem it does not work :

    function my_minimum_limit_shipping_rates_function( $rates, $package ) {
    $shipping_minimum = 10; // The maximum amount would be $10.50
    $only_apply_to_rates = array( ‘263021’, ‘flat_rate’ ); // Enter the shipping IDs here
    // Loop through all rates
    foreach ( $rates as $rate_id => $rate ) {
    // Skip the shipping rates that are not in the list
    if ( ! in_array( $rate_id, $only_apply_to_rates ) ) {
    continue;
    }
    // Check if the rate is higher then a certain amount
    if ( $rate->cost < $shipping_minimum ) {
    $rate->cost = $shipping_minimum;
    }
    }
    return $rates;
    }
    add_action( ‘woocommerce_package_rates’, ‘my_minimum_limit_shipping_rates_function’, 10, 2 );

Viewing 1 replies (of 1 total)

The topic ‘Minimum order per shipping method’ is closed to new replies.