Local Pickup: Hide the shipping option for certain product categories

By default, CheckoutWC shows the Shipping option in the Delivery Method step for every cart. If some of your products can only be collected in person and should never be shipped, you can hide the shipping method for that category automatically whenever one of those products is in the cart, so Local Pickup becomes the only choice.

When you’d want this

This is for stores where part of the catalog isn’t shippable. Common cases:

  • Bulky, fragile, or hazardous items that can’t go through a carrier
  • Perishables or made-to-order goods meant for local collection only
  • In-store services, classes, or event tickets that have nothing to ship

Without a rule like this, you’re relying on customers to read a note and pick Local Pickup themselves. When they don’t, you’re left cancelling orders, refunding shipping, and chasing people to rebook. This enforces it at checkout instead: as soon as a product from your chosen category is in the cart, the Shipping option disappears and only Local Pickup remains.

How to hide the shipping method for a category

This assumes Local Pickup is already enabled as a shipping method. If you haven’t set that up yet, WooCommerce’s Local Pickup documentation covers the basics, and CheckoutWC’s own Local Pickup guide explains how pickup options appear in the Delivery Method step.

Add the snippet below using a code snippets plugin or your child theme’s functions.php, then change the category slug to match your own. You can find a category’s slug under Products > Categories in your WordPress admin.

A note on mixed carts

This hides the Shipping option whenever at least one product in the cart belongs to your chosen category, even if other, shippable products are also present. So a cart holding both a pickup-only item (Category A) and a shippable item (Category B) will only offer Local Pickup. If you need shippable products to stay shippable in mixed carts, this snippet isn’t the right fit.