Ultimate Member WooCommerce Country Pricing
This WordPress plugin integrates Ultimate Member with WooCommerce to provide dynamic, country-specific pricing for products.
by Your Name · github.com/arrantodd-cmd/um-woocommerce-country-pricing · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/arrantodd-cmd/um-woocommerce-country-pricing/archive/refs/heads/main.zipA WordPress plugin that dynamically adjusts WooCommerce product prices based on the user's country stored in their Ultimate Member profile.
Description
This plugin integrates Ultimate Member with WooCommerce to provide country-specific pricing. When a user registers through Ultimate Member and selects their country, this information is used to automatically adjust product prices in their WooCommerce cart.
Features
- Country-based Pricing: Automatically adjusts product prices based on user's country
- Ultimate Member Integration: Uses country data from Ultimate Member user profiles
- Flexible Pricing Rules: Easy-to-configure pricing rules for different countries
- Cart Integration: Seamlessly integrates with WooCommerce cart calculations
- Product-specific Rules: Option to apply pricing rules to specific products only
Requirements
- WordPress 5.0 or higher
- WooCommerce 3.0 or higher
- Ultimate Member plugin
- PHP 7.4 or higher
Installation
Manual Installation
- Download the plugin files
- Upload the
um-woocommerce-country-pricingfolder to your/wp-content/plugins/directory - Activate the plugin through the 'Plugins' menu in WordPress
- Ensure Ultimate Member and WooCommerce are installed and active
Via WordPress Admin
- Go to Plugins > Add New
- Upload the plugin zip file
- Activate the plugin
Configuration
Ultimate Member Setup
- In your Ultimate Member registration form, add a country field
- Set the field meta key to
country - Configure the field to save the two-letter country code (e.g., 'DE', 'CA', 'GB')
Pricing Rules Configuration
Edit the um-woocommerce-country-pricing.php file to customize pricing rules:
switch (strtoupper($country_code)) {
case 'DE': // Germany
return 75.00; // Flat rate of €75
break;
case 'CA': // Canada
return $original_price * 0.90; // 10% discount
break;
case 'GB': // United Kingdom
return $original_price + 5.00; // £5 surcharge
break;
}
Product-Specific Rules
To apply pricing rules only to specific products, uncomment and modify the product ID checks:
case 'DE': // Germany
if ($product_id == YOUR_PRODUCT_ID) {
return 75.00;
}
return $original_price;
break;
Usage
- User Registration: Users register through Ultimate Member and select their country
- Country Storage: The country code is saved to the user's profile under the
countrymeta key - Cart Addition: Users add products to their WooCommerce cart
- Price Adjustment: The plugin automatically adjusts prices based on the user's country
- Checkout: Users proceed to checkout with the adjusted prices
Supported Countries
The plugin includes pricing rules for the following countries:
- Germany (DE): Flat rate of €75
- Canada (CA): 10% discount
- United Kingdom (GB): £5 surcharge
- United States (US): No change
- France (FR): 5% discount
- Australia (AU): 10% surcharge
Adding New Countries
To add pricing rules for new countries:
- Open
um-woocommerce-country-pricing.php - Add a new case to the switch statement:
case 'XX': // Your Country
return $original_price * 1.15; // 15% surcharge example
break;
Troubleshooting
Common Issues
-
Prices not adjusting:
- Ensure the user is logged in
- Verify the country is saved in the user's profile
- Check that Ultimate Member and WooCommerce are active
-
Country not saving:
- Verify the Ultimate Member field meta key is set to
country - Check that the field is configured to save the country code
- Verify the Ultimate Member field meta key is set to
-
Plugin not activating:
- Ensure WooCommerce and Ultimate Member are installed and active
- Check PHP version compatibility
Debug Mode
To debug pricing adjustments, add this code temporarily:
// Add this in the adjust_prices_by_country method for debugging
error_log('User Country: ' . $user_country);
error_log('Original Price: ' . $original_price);
error_log('Adjusted Price: ' . $adjusted_price);
Changelog
Version 1.0.0
- Initial release
- Basic country-based pricing functionality
- Integration with Ultimate Member and WooCommerce
- Support for multiple pricing rules
Support
For support and questions:
- Create an issue on GitHub
- Check the WordPress.org support forums
- Review the plugin documentation
License
This plugin is licensed under the GPL v2 or later.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Credits
Developed for WordPress community integration between Ultimate Member and WooCommerce.