• Resolved craigmckee

    (@craigmckee)


    I have used the following code to hide paid shipping option when the user qualifies for free shipping. This works but it also hides Local Collection which I would like to keep. Any ideas please?

    /**
     * Hide shipping rates when free shipping is available.
     *
     * @param array $rates Array of rates found for the package.
     * @return array
     */
    function dokan_vendor_shipping_hide_when_free_is_available( $rates ) {
        $free = array();
        foreach ( $rates as $rate_id => $rate ) {
            if ( 'free_shipping' === $rate->method_id || 'free_shipping' === $rate->id || strpos( $rate->id, 'free_shipping' ) !== false ) {
                $free[ $rate_id ] = $rate;
                break;
            }
        }
        return ! empty( $free ) ? $free : $rates;
    }
    add_filter( 'woocommerce_package_rates', 'dokan_vendor_shipping_hide_when_free_is_available', 100 );
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Jahidul Hassan Mojumder

    (@jahidulhassan)

    Hi @craigmckee

    The Dokan lite does not include vendor shipping. As you are referring to vendor shipping, we are unable to discuss this issue in this forum as per the forum’s rule as this is not included in Dokan lite.

    But you are always welcome to contact our support via this URL.

    Thanks!

    Plugin Support Jahidul Hassan Mojumder

    (@jahidulhassan)

    Hi @craigmckee

    As your query has been responded to, I am marking this topic as resolved. Feel free to open a new one if you face any further issues.

    Regards!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Remove Paid Shipping When Free is Available but keep pickup’ is closed to new replies.