Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/iamtoxima/product-based-shipping-logic/archive/refs/heads/main.zipProduct Based Shipping Logic for WooCommerce is a small, secure WooCommerce plugin that lets store owners increase shipping cost site-wide based on the total number of products in the cart.
It is useful when you already have many WooCommerce shipping zones and do not want to manually edit every zone formula. The plugin keeps your existing shipping-zone prices as the base cost, then adjusts the final shipping rate during WooCommerce's server-side shipping calculation.
Author: Toxima
Contact: officialdevtosin@gmail.com
What The Plugin Does
- Adds an admin settings page at
WooCommerce > Product Shipping Logic. - Applies one site-wide shipping adjustment rule across your WooCommerce store.
- Uses your existing WooCommerce shipping-zone cost as the base shipping amount.
- Supports multiplication-based shipping increases.
- Supports percentage-based shipping increases.
- Applies to
Flat rateshipping by default. - Can optionally apply to all paid shipping methods.
- Never increases
Free shipping. - Never increases
Local pickup. - Supports an optional maximum shipping cap.
- Recalculates shipping server-side when WooCommerce calculates cart and checkout totals.
- Clears WooCommerce shipping cache when plugin settings change.
Example Use Case
You have many shipping zones:
- Lagos flat rate:
2000 - Abuja flat rate:
3500 - Port Harcourt flat rate:
4000
Without this plugin, you may need to edit each zone manually.
With this plugin, you leave those base prices alone. If a customer increases product quantity, the plugin adjusts the final shipping cost automatically.
Example with a base shipping fee of 2000:
| Cart Quantity | Final Shipping |
|---|---|
| 1 | 2000 |
| 2 | 4000 |
| 3 | 6000 |
| 4 | 8000 |
Adjustment Modes
Multiplication Mode
This mode multiplies the base shipping fee by the cart quantity and by your configured multiplier value.
Formula:
base shipping x cart quantity x multiplier
Recommended setting for normal per-product shipping:
Multiplier per item: 1
Example:
Base shipping: 20
Quantity: 3
Multiplier: 1
Final shipping: 60
Percentage Mode
This mode increases the base shipping fee by a percentage for each extra item after the first item.
Formula:
base shipping + percentage increase for each extra item
If the percentage is 100, the result is the same as normal quantity multiplication.
Example:
Base shipping: 20
Quantity: 3
Percentage per extra item: 100
Final shipping: 60
Another example:
Base shipping: 1000
Quantity: 3
Percentage per extra item: 50
Final shipping: 2000
That means:
- First item keeps the base shipping:
1000 - Second item adds 50%:
500 - Third item adds 50%:
500 - Final shipping:
2000
Installation From WordPress Admin
- Download
product-based-shipping-logic.zip. - In WordPress admin, go to
Plugins > Add New. - Click
Upload Plugin. - Upload
product-based-shipping-logic.zip. - Click
Install Now. - Click
Activate Plugin. - Go to
WooCommerce > Product Shipping Logic. - Configure the shipping adjustment.
- Save the settings.
Manual Installation
- Upload the plugin files to:
wp-content/plugins/product-based-shipping-logic
- Activate
Product Based Shipping Logic for WooCommercefrom the WordPress plugins page. - Go to
WooCommerce > Product Shipping Logic. - Configure and save your settings.
Recommended Settings
For your original use case, use:
Enable adjustment: Enabled
Adjustment mode: Multiply base shipping by cart quantity
Multiplier per item: 1
Shipping methods affected: Flat rate only
Start adjustment at quantity: 2
Optional maximum shipping charge: leave empty
This gives:
20 x 1 product = 20
20 x 2 products = 40
20 x 3 products = 60
Settings Explained
Enable Adjustment
Turns the plugin logic on or off without deactivating the plugin.
Adjustment Mode
Choose how shipping should increase:
Multiply base shipping by cart quantityIncrease base shipping by percentage per extra item
Multiplier Per Item
Used only in multiplication mode.
Set this to 1 if every product should add one full shipping fee.
Percentage Per Extra Item
Used only in percentage mode.
Set this to 100 if every extra product should add another full shipping fee.
Set this to 50 if every extra product should add half of the base shipping fee.
Shipping Methods Affected
Recommended:
Flat rate only
This keeps the plugin focused on WooCommerce flat-rate shipping zones.
Advanced option:
All paid shipping methods
This can affect other paid shipping methods. Use it carefully and test before using it on a live store.
Start Adjustment At Quantity
Default:
2
This means quantity 1 keeps the original shipping price, and the plugin starts increasing shipping when the cart has 2 or more items.
Optional Maximum Shipping Charge
Leave empty for no maximum.
If you set a value, the plugin will not allow adjusted shipping to go above that amount.
What It Does Not Do
- It does not replace WooCommerce shipping zones.
- It does not create new shipping zones.
- It does not change product prices.
- It does not change tax settings.
- It does not increase free shipping.
- It does not increase local pickup.
- It does not rely on checkout JavaScript for security.
Security
The plugin is designed to keep shipping calculation secure and server-side.
- Admin settings are saved through the WordPress Settings API.
- The settings page requires the
manage_woocommercecapability. - Admin inputs are sanitized before storage.
- Admin output is escaped before display.
- Shipping calculation runs through WooCommerce's server-side
woocommerce_package_ratesfilter. - The plugin does not trust customer-side checkout input for final shipping totals.
- Structured errors use WooCommerce's centralized logger.
Caching
The plugin does not create a separate long-lived cache.
It relies on WooCommerce's shipping-rate caching and clears the WooCommerce shipping cache version when plugin settings are updated.
Testing Checklist
Before using this plugin on a live store:
- Test on a local or staging WordPress site.
- Install and activate WooCommerce.
- Create at least one test product.
- Create one shipping zone with a flat-rate cost, for example
20. - Activate this plugin.
- Go to
WooCommerce > Product Shipping Logic. - Enable multiplication mode with multiplier
1. - Add one product to cart and confirm shipping is
20. - Increase quantity to
2and confirm shipping is40. - Increase quantity to
3and confirm shipping is60. - Test free shipping and local pickup if your store uses them.
- Test checkout using your normal payment method in test mode.
Requirements
- WordPress 6.0 or newer
- PHP 7.4 or newer
- WooCommerce 7.0 or newer
License
GPL v2 or later.