• Hi all

    So I own a bakery website and I only want “Cake Collection” to be available for the cakes as they are collection only but still leave the rest of the products with the other delivery options, how do I go about this?

    Thanks
    Ash

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi Ash,
    Can you give more details? May be any site or illustration.
    Your “Cake Collection” above sounds like List of products category.

    Thread Starter agentash

    (@agentash)

    Sure, our website is https://www.veganantics.co.uk , we just need to disable all of the shipping methods for our “Cakes” category except our “Cake Collection” shipping method, I thought this might have been a core option in WordPress?

    Thread Starter agentash

    (@agentash)

    Hi that is fine, we already have the price for delivery to £0 for the cakes but we need to hide all the other delivery methods so customers do not accidentally choose them?

    https://docs.woocommerce.com/document/hide-other-shipping-methods-when-free-shipping-is-available/#snippets-for-wc-26

    try Code Snippets for WC 2.6+ in above article with your “Cakes Collection” category:
    (put it to functions.php of your childtheme/theme)

    if ( ! is_category( your-category-id ) ) {
         /**
          * 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 );
    }

    Cheer

    • This reply was modified 7 years, 10 months ago by Trung Nguyen.
    Thread Starter agentash

    (@agentash)

    Is there a way I can change the code? We currently use “Free Shipping” as standard on our website and we use “Local Pickup” as 0.00 charge so how do I customise this with a new delivery type? i.e “Cake Collection”

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Disable shipping methods?’ is closed to new replies.