[WordPress] 外掛分享: GazChap’s WooCommerce getAddress.io Postcode Lookup

首頁外掛目錄 › GazChap's WooCommerce getAddress.io Postcode Lookup
⚠ 此外掛已下架 — 不再更新維護,建議勿安裝。
400+
安裝啟用
★★★★★
5/5 分(16 則評價)
107 天前
最後更新
問題解決
WordPress 4.8.0+ PHP 5.6+ v3.2.4 上架:2019-02-23

內容簡介

此外掛可讓顧客透過輸入郵遞區號和從選項中選擇地址完成帳單/收件地址。它使用 getAddress.io (https://getaddress.io) 的 Royal Mail 郵遞區號地址檔進行查詢。

整合需要 API 金鑰才能運作,且僅會出現在用戶選擇英國 (或更具體地說, ISO-3166-2 代碼「GB」) 為他們的國家時。

可選擇在貨運或帳單地址上關閉,並可配置在 getAddress.io API 金鑰達到使用限制時向指定地址發送電子郵件通知。

可使用 getAddress.io 的多個測試郵編進行測試,該網站提供XX2 00X、XX4 04X、XX4 00X、XX4 01X、XX4 29X和XX5 00X等測試區號。API 金鑰需使用 getaddress.io 的 API 金鑰,不同定價方案提供不同服務。

需安裝 WooCommerce,版本至少 3.0。在安裝和啟用插件後,您需要在 WordPress 儀表板的 WooCommerce -> 設定 -> 一般 頁面中進行配置。如果某些也修改結帳欄位的外掛可能會與此外掛發生衝突,您可以使用 Hook 優先級來解決此問題。

對於開發人員,作者提供了一些過濾器,可用於自定義外掛的某些方面。過濾器可以調整一些使用者介面和錯誤訊息的文本。

外掛標籤

開發者團隊

⬇ 下載最新版 (v3.2.4) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「GazChap's WooCommerce getAddress.io Postcode Lookup」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

This plugin enables your customers to complete their billing/shipping addresses by entering their postcode and selecting their address from the options given.
It utilises getAddress.io (https://getaddress.io) to do the lookup using their Royal Mail Postcode Address File.
An API key is required for the integration to work, and the integration only appears when the customer has selected United Kingdom (or, more specifically, the ISO-3166-2 code “GB”) for their country.
It can optionally be turned off for the shipping or billing addresses, and can be enabled or disabled in each of the checkout, customer account and WooCommerce admin screens.
Postcodes that are looked up are saved in a custom database table for 24 hours to help reduce your costs for use of the getAddress.io API.
IMPORTANT NOTE
With the update to v3.2.4, I have had to make the difficult decision to discontinue this plugin.
There are legal and ethical concerns regarding the source of the data used by the getAddress.io API, and consequently to protect myself and my users, I have little choice but to discontinue the plugin development.
After the plugin update (or a new installation) the plugin will remain active for 30 days and then the lookup facilities will no longer be available, at which point you should deactivate and uninstall the plugin. A notice will be displayed in the admin panel informing you of this, showing the date that your lookup will cease to function.
I am unable to field queries regarding possible alternative providers or plugins, but WooCommerce have recently added a native Address Lookup system into version 10.3 of WooCommerce which should rapidly become popular and gain the support of most postcode lookup services.
For more information: https://blog.ideal-postcodes.co.uk/ideal-postcodes-wins-high-court-ruling
Requirements
WooCommerce, at least version 3.0.
getAddress.io API Key. A number of pricing plans are available.
Note: Currently, this plugin does NOT support WooCommerce Checkout Blocks introduced as the default checkout experience in WooCommerce version 8.3, it can only be used with the WooCommerce checkout shortcode. I aim to make this plugin compatible with Checkout Blocks as soon as possible.
Usage
Once installed and activated, you need to go to the WooCommerce -> Settings -> General page in the WordPress dashboard. You can enter your API key and set your other options here.
Conflicts with other plugins
Certain plugins that also modify checkout fields can conflict with this plugin and prevent it from working.
Usually, the symptom of this is that the “Find Address” button does not appear.
Since version 2.1, I’ve added a Hook Priority setting at the bottom of the settings for the plugin that you can use to try and fix these conflicts.
The default priority is 10, but using a higher number makes my plugin modify the checkout later in the process – you will probably need to experiment to find the priority that makes my plugin’s changes happen after the conflicting plugin.
For example, a priority of 1001 seems to fix conflicts with the “Checkout Field Editor” plugin by ThemeHigh.
Filter Reference
For developers, I’ve included a few filters that you can use to customise certain aspects of the plugin. These are:
User Interface
All of these filters take one argument, $text.
gazchaps-woocommerce-getaddress-io_find-address-button-text - the text shown on the Find Address buttons (default: Find Address)
gazchaps-woocommerce-getaddress-io_find-address-searching-text - the text shown when the Find Address button is selected (default: Searching...)
gazchaps-woocommerce-getaddress-io_enter-address-manually-text - the text shown for the "Enter an address manually" link (default: Enter an address manually)

Note: Although these two texts are translatable, filters will override any translations.
Error Messages
All of these filters take one argument, $message, the error message that will be displayed to the user.
gazchaps-woocommerce-getaddress-io_api_error_400 - shown when the postcode supplied is invalid/empty
gazchaps-woocommerce-getaddress-io_api_error_401 - shown when the API key provided in the settings is invalid
gazchaps-woocommerce-getaddress-io_api_error_404 - shown when no addresses were found for the supplied postcode
gazchaps-woocommerce-getaddress-io_api_error_429 - shown when the API key has hit its usage limit
gazchaps-woocommerce-getaddress-io_api_error_500 - shown when there is a server error at getAddress.io

Note: By default, the error messages are “customer friendly”, i.e. they don’t go into much detail about the cause of the error!
Styling
gazchaps-woocommerce-getaddress-io_billing_selector_row_class - changes the CSS class on the form-row that the billing address selector is placed into
gazchaps-woocommerce-getaddress-io_shipping_selector_row_class - changes the CSS class on the form-row that the shipping address selector is placed into
gazchaps-woocommerce-getaddress-io_clear_additional_fields - defaults to true, set to '__return_false' to stop the "additional fields" area of the checkout having a clear style applied to it

License

Licensed under the [GNU General Public License v2.0](http://www.gnu.org/licenses/gpl-2.0.html)

延伸相關外掛

文章
Filter
Apply Filters
Mastodon