外掛說明
Pirajki Shipping Calculator for WooCommerce solves a common problem: when creating manual orders in the WooCommerce admin, shipping rates are not automatically calculated from the customer’s postcode the way they are on the front end.
This plugin adds intelligent shipping rate lookup directly to the order edit screen:
- Auto-calculates rates whenever the shipping postcode changes — no button click needed
- Auto-applies the highest rate immediately so you never under-charge
- Shows all available methods as a selectable list so you can override the auto-selected rate
- Manual fallback — if no rates are found you can enter a label and cost manually
- Country auto-detection — correctly resolves Guernsey (GYGG), Jersey (JE), and Isle of Man (IM) postcodes that the WC admin often leaves as GB
- Compatible with Advanced Shipping plugin (WAS_Advanced_Shipping_Method) — queries its condition groups directly
- HPOS compatible — works with WooCommerce High-Performance Order Storage
- Secure — nonce-verified AJAX, full capability checks, all inputs sanitised
How it works
- Open any order in WooCommerce admin
- Enter a postcode in the shipping or billing address fields
- Rates are fetched and the highest cost rate is applied automatically
- All available rates are shown — click a different one and press Apply selected rate to override
- The order items panel updates in real time
Developer Hooks
Filters:
pirajki_sc_found_rates — modify the array of rates before they are shown to the admin.
pirajki_sc_auto_apply_rate — override which rate gets automatically applied (or return null to disable auto-apply).
Actions:
pirajki_sc_after_rate_saved — fires after a shipping rate has been saved to an order. Receives `$order`, `$label`, `$cost`.
Requirements
- WordPress 5.8+
- WooCommerce 6.0+
- PHP 7.4+
- Advanced Shipping plugin (optional — falls back to WooCommerce native shipping zones)
安裝方式
- Upload the
pirajki-shipping-calculatorfolder to/wp-content/plugins/ - Activate the plugin through the Plugins menu in WordPress
- No configuration needed — it works automatically on the order edit screen
常見問題集
-
Does this work with native WooCommerce shipping zones?
-
Yes. If the Advanced Shipping plugin is not active, the plugin falls back to WooCommerce’s native shipping pipeline and queries standard flat rate, free shipping, and other native methods.
-
Why does it apply the highest rate automatically?
-
When creating manual orders it is safer to start with the highest applicable rate to avoid under-charging. You can always override it by selecting a different rate from the list shown. If you prefer a different auto-apply strategy, use the
pirajki_sc_auto_apply_ratefilter. -
The rates panel shows “No rates found” — why?
-
The most common reasons:
1. No shipping zone covers the destination postcode/country in WooCommerce Settings Shipping
2. The product in the order is virtual or downloadable (no shipping required)
3. A minimum order amount condition in Advanced Shipping is not met
4. The order has no products yet — add products and click Recalculate first -
Does it work with WooCommerce HPOS (High-Performance Order Storage)?
-
Yes — the plugin declares HPOS compatibility and handles both classic (post-based) and HPOS order screens.
-
Is it compatible with Guernsey, Jersey, and Isle of Man postcodes?
-
Yes. Postcodes starting with GY, JE, and IM are automatically mapped to their correct ISO country codes (GG, JE, IM) even when the WooCommerce admin form leaves the country set to GB.
使用者評論
這個外掛目前沒有任何使用者評論。
參與者及開發者
變更記錄
1.0.3
- Fix: Renamed all functions, classes, constants and hooks to pirajki_sc_ prefix
- Fix: Replaced inline tag with wp_enqueue_script + wp_localize_script
- Fix: Plugin name and readme updated to match WordPress.org requirements
- Fix: Author URI updated to domain without WordPress trademark
1.0.2
- Fix: esc_attr() now applied at point of output for JSON radio values
- Fix: phpcs ignore comments suppress both DirectQuery and NoCaching rules
- Fix: Upgrade notice trimmed to within 300 character limit
1.0.1
- Fix: All output escaped via wp_kses_post and esc_attr
- Fix: Taxes array properly unslashed before sanitisation
- Fix: Direct DB queries use prepared statements and transient caching
- Fix: Removed discouraged load_plugin_textdomain call
1.0.0
- Initial release
- Auto-calculation on postcode change with debouncing
- Auto-apply highest rate
- Advanced Shipping plugin integration
- Channel Islands / Isle of Man postcode auto-detection
- HPOS compatibility
- Manual cost fallback
- Developer filters and actions