• Resolved valeriemw

    (@valeriemwgmailcom)


    Hello,

    The shipping for this site works correctly except that when free shipping is deployed (for orders of $75 or more), the flat rate continue to show in the cart as an option.

    Is there a way to make the flat rate shipping disappear if free shipping is activated?

    Thank you in advance!

    Valerie

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • This is not specifically an issue with the Storefront theme, but a general WooCommerce issue, but in order to make all shipping options disappear if Free shipping is an option, you can use some custom code:

    /**
     * Hide shipping rates when free shipping is available.
     * Updated to support WooCommerce 2.6 Shipping Zones.
     *
     * @param array $rates Array of rates found for the package.
     * @return array
     */
    function my_hide_shipping_when_free_is_available( $rates ) {
    	$free = array();
    	foreach ( $rates as $rate_id => $rate ) {
    		if ( 'free_shipping' === $rate->method_id ) {
    			$free[ $rate_id ] = $rate;
    			break;
    		}
    	}
    	return ! empty( $free ) ? $free : $rates;
    }
    add_filter( 'woocommerce_package_rates', 'my_hide_shipping_when_free_is_available', 100 );

    Source: WooCommerce.com

    Add this code via a plugin that allows custom functions to be added, such as the Code snippets plugin. Don’t add custom code directly to any of your theme’s files as this will be wiped entirely when you update the theme.

    Thread Starter valeriemw

    (@valeriemwgmailcom)

    Thank you so much!! This worked perfectly.
    I’m grateful.
    Stay safe,
    Valerie

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Flat rate shipping shows on free shipping option’ is closed to new replies.