The local pickup feature for WooCommerce’s new block-based checkout has an option to apply one global cost to all locations. But many stores need different costs per location—for example, a downtown location might charge $5 while a warehouse is free. Hopefully in the future WooCommerce will integrate variable pricing for different pickup locations into core or a plugin like Local Pickup Plus will update it’s code to work with the new block-based WooCommerce checkout.
In the meantime, we created a little WooCommerce Local Pickup Costs plugin to solve this. It adds location-specific cost overrides and URL-based pre-selection directly into the WooCommerce local pickup shipping settings.

The Problem
WooCommerce’s local pickup shipping method only allows one global cost for all locations. This limits flexibility for:
- Stores with multiple locations that need different pricing
- Businesses offering free pickup at some locations and paid at others
- Marketing campaigns that need to pre-select specific pickup locations
The Solution
The WooCommerce Local Pickup Costs plugin extends WooCommerce’s shipping system to provide location-specific cost overrides. It integrates seamlessly with WooCommerce’s shipping settings and works with the modern Checkout Blocks.
Key Features
- Location-Specific Costs: Set custom pickup costs for each local pickup location
- Cost Overrides: Override the global cost from WooCommerce Local Pickup settings
- URL Pre-selection: Pre-select pickup location using ?pickup_location=location-id URL parameter
- Auto-selection: Automatically select the local pickup shipping method when pre-selecting a location
- Admin Interface: User-friendly settings page under WooCommerce > Settings > Shipping > Local Pickup Costs
How It Works
- Admin Settings: The plugin adds a “Local Pickup Costs” tab under WooCommerce > Settings > Shipping that lists all configured local pickup locations in a table format
- Cost Override: When a customer selects a pickup location at checkout, the plugin checks if a location-specific cost is set and applies it instead of the global cost
- URL Parameter: The pickup_location parameter in the URL triggers JavaScript that automatically selects the pickup method and location on the checkout page
Cost Logic
- Empty field: Uses the global cost from Local Pickup settings
- Set to 0: Makes the location free (overrides global cost)
- Any number: Uses the custom cost for that location
Installation & Usage
- Download the plugin on GitHub
- Upload the plugin files to /wp-content/plugins/woocommerce-local-pickup-costs/
- Activate the plugin through the ‘Plugins’ menu in WordPress
- Go to WooCommerce > Settings > Shipping > Local Pickup Costs
- Configure costs for each pickup location
Setting Location-Specific Costs
- Navigate to WooCommerce > Settings > Shipping
- Click on the “Local pickup” tab and enable “Add a price for customers who choose local pickup”
- Set your cost and then add your pickup locations and save changes
- Click on the Local Pickup Costs tab
- For each pickup location, enter a custom cost or leave blank to use the global cost (Set to 0 to make a location free) and save changes
URL Pre-selection
Add the pickup_location parameter to your checkout URL to pre-select a specific location: https://yoursite.com/checkout/?pickup_location=1
This will:
- Automatically select the local pickup shipping method
- Pre-select the specified pickup location
- Apply the location-specific cost
Technical Details
Built with performance and security in mind, the plugin:
- Uses static caching to reduce database queries during the same request
- Implements optimized location matching using lookup arrays (O(1) instead of O(n))
- Hooks into woocommerce_package_rates to modify shipping rates before display
- Integrates with WooCommerce Store API for Checkout Blocks compatibility
- Includes nonce verification for all form submissions
- Implements proper input sanitization and output escaping
- Declares HPOS (High-Performance Order Storage) compatibility
The plugin uses the following WooCommerce hooks:
- woocommerce_get_sections_shipping: Add new tab to shipping settings
- woocommerce_get_settings_shipping: Render settings page
- woocommerce_package_rates: Modify shipping rates based on location costs
- woocommerce_settings_save_shipping: Save location costs
- woocommerce_store_api_checkout_update_order_from_request: Apply costs in Checkout Blocks
Get the Plugin
Available on GitHub: WooCommerce Local Pickup Costs
The plugin is open source and follows WordPress coding standards. Contributions and feedback are welcome.
Requirements
- WordPress 5.8 or higher
- WooCommerce 3.0 or higher
- PHP 7.4 or higher

0 Comments