
內容簡介
### 總結:
Multi-Country Products Manager 是一個 WordPress 外掛,能夠讓 WooCommerce 商店管理高達 2 個國家的產品,具有手動價格控制和特定國家的產品可用性功能。
### 問題與答案:
1. Multi-Country Products Manager 可以支援多少個國家?
- Multi-Country Products Manager 可以支援基本的美國加上另一個國家。
2. 如何設定產品的價格?
- 可以手動為每個國家設定特定價格。
3. 如何在不同國家間切換?
- 透過簡單的國家選擇界面實現國家切換。
4. 這個外掛支援哪些國家?
- 可以選擇從 60 多個預定義的國家,包括主要經濟體國家、東盟國家、中東國家、非洲國家等。
5. 關於匯率方面的處理方式?
- 只能手動輸入匯率,商店擁有者可以自行設定匯率,並且沒有自動更新功能。
外掛標籤
開發者團隊
② 後台搜尋「Multi-Country Products Manager for WooCommerce」→ 直接安裝(推薦)
原文外掛簡介
Multi-Country Products Manager enables WooCommerce stores to manage products for up to 2 countries with manual pricing control and country-specific product availability.
Key Features
2-Country Support: Support for US (base) + 1 additional country
Manual Pricing Control: Set specific prices for each country manually
Country Switching: Simple country selection interface
Product Filtering: Show only products available in user’s country
Admin Interface: Clean settings and product management
Cart Integration: Country information preserved in orders
Supported Countries
Choose from 60+ predefined countries including:
* Major economies (US, UK, EU countries, Japan, China, India)
* ASEAN countries (Singapore, Malaysia, Thailand, Philippines)
* Middle East (UAE, Saudi Arabia, Qatar)
* Africa (Nigeria, South Africa, Kenya)
* And many more
Exchange Rates
Manual exchange rate entry only
Store owners set their own rates
No automatic updates
License
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
External services
This plugin uses the following external geolocation services to detect user’s country for automatic country switching:
IP-API
Service: IP-API provides country geolocation based on IP address
Data sent: User’s IP address for country lookup
When used: When user first visits the site or when country detection is triggered
Provider information: IP-API (see their privacy policy at ip-api.com/docs/legal)
IPAPI.co
Service: IPAPI.co provides IP geolocation and country detection
Data sent: User’s IP address for country lookup
When used: When IP-API fails or as a fallback service
Provider information: IPAPI.co (terms at ipapi.co/terms, privacy policy at ipapi.co/privacy)
IPinfo.io
Service: IPinfo.io provides IP address to country detection
Data sent: User’s IP address for country lookup
When used: When both IP-API and IPAPI.co fail or as a final fallback service
Provider information: IPinfo.io (terms at ipinfo.io/terms, privacy policy at ipinfo.io/privacy-policy)
Note: The plugin attempts to use these services in sequence until successful country detection occurs. If all services fail, the default country (US) is used. User’s IP is transmitted only for determining the country code, and no personal information is stored on these external services.
Developer Documentation
Plugin Architecture
The plugin follows a modular architecture:
`
multi-country-products-manager-for-woocommerce/
│
├── multi-country-products-manager-for-woocommerce.php # Main plugin bootstrap file
├── includes/
│ ├── class-mcpmwoo-core.php # Core plugin loader and initialization
│ ├── class-mcpmwoo-country.php # Country management (2-country limit)
│ ├── class-mcpmwoo-admin.php # Admin interface and settings
│ ├── class-mcpmwoo-product.php # Product pricing and filtering
│ ├── class-mcpmwoo-ajax.php # AJAX handlers for country switching
│ ├── class-mcpmwoo-hooks.php # WordPress/WooCommerce hooks
│ └── helpers.php # Helper functions
├── assets/
│ ├── css/
│ │ ├── mcpmwoo-admin.css # Admin styling
│ │ └── mcpmwoo-frontend.css # Frontend styling
│ └── js/
│ ├── mcpmwoo-dropdown.js # Country switching
│ └── mcpmwoo-multi-country.js # Admin functionality
└── languages/ # Translation files
└── multi-country-products-manager-for-woocommerce.pot # Translation template
`
Class Structure
MCPMWOO_Core: Main plugin loader and dependency manager
MCPMWOO_Country: Country data management (2-country limitation)
MCPMWOO_Admin: WordPress admin interface and settings
MCPMWOO_Product: Product-specific functionality and WooCommerce integration
MCPMWOO_Ajax: AJAX request handling
MCPMWOO_Hooks: WordPress and WooCommerce hooks registration
Helper Functions
The plugin provides helper functions for developers:
`php
// Get current user’s country
$country = mcpmwoo_get_current_country();
// Check if product is available in a country
$available = mcpmwoo_is_product_available_in_country($product_id, ‘US’);
// Get country-specific price
$price = mcpmwoo_get_product_country_price($product_id, ‘GB’, ‘regular’);
// Get all countries (max 2)
$countries = mcpmwoo_get_countries();
`
Hooks and Filters
The plugin provides hooks for customization:
mcpmwoo_before_country_switch – Action before country switching
mcpmwoo_after_country_switch – Action after country switching
mcpmwoo_country_currencies – Filter to modify available currencies
Security Features
WordPress nonces for all AJAX requests
Input sanitization and validation
Capability checks for admin functions
SQL injection prevention through WordPress APIs
