WP SITES

3082 Coded Tutorials & 284 Plugins

Hide Shipping Options Based on Product Categories in WooCommerce

$75.00
Watch Demo

This code enables you to hide shipping methods on the cart and checkout pages based on the product categories your cart items are assigned to.

In this case, we have configured 3 shipping methods:

  1. Standard Flat rate
  2. Express Flat Rate
  3. Click & Collect Local Pickup

There are standard products assigned the dress category and products assigned the accessory category.

Shipping Method Display

Shipping options are displayed and hidden based on products in cart :

  1. When only products in the accessory category are in cart, only the Standard Delivery: $6.00 and Click & Collect ( Local Pickup ) options are displayed
  2. When products from both the dress and accessory categories are in cart, Standard Delivery: $26, Express Delivery: $36.0 and Click & Collect shipping options display
  3. When only products from the dress category are in cart, Standard Delivery: $20, Express Delivery: $30.0 and Click & Collect shipping options are displayed.

There’s 2 different solutions in the download folder :

  1. The 1st solution only shows shipping methods when products from the dress and/or accessory categories are in cart based on the above conditions.
  2. The 2nd solution shows shipping methods for all categories.

Screenshots

Click to enlarge. Shows the cart page based on the 3 scenarios above.

Usage

  • Swap out your product category slugs on lines 21 and 23.
  • On lines 31, 32 and 33, swap out your shipping ids. ( How To Find Shipping Method Ids ).
  • Copy and paste the PHP code to the end of your child themes functions file or custom code snippets plugin.

Versions

Current version is V2-121595.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Contact Us If You Have Any Questions

Go back

Your message has been sent

Warning
Warning
Warning
Warning.