WP Manifestindependent plugin directory
manifest / ecommerce / um-woocommerce-country-pricing

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

0stars
0forks

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.zip

A 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

  1. Download the plugin files
  2. Upload the um-woocommerce-country-pricing folder to your /wp-content/plugins/ directory
  3. Activate the plugin through the 'Plugins' menu in WordPress
  4. Ensure Ultimate Member and WooCommerce are installed and active

Via WordPress Admin

  1. Go to Plugins > Add New
  2. Upload the plugin zip file
  3. Activate the plugin

Configuration

Ultimate Member Setup

  1. In your Ultimate Member registration form, add a country field
  2. Set the field meta key to country
  3. 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

  1. User Registration: Users register through Ultimate Member and select their country
  2. Country Storage: The country code is saved to the user's profile under the country meta key
  3. Cart Addition: Users add products to their WooCommerce cart
  4. Price Adjustment: The plugin automatically adjusts prices based on the user's country
  5. 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:

  1. Open um-woocommerce-country-pricing.php
  2. Add a new case to the switch statement:
case 'XX': // Your Country
    return $original_price * 1.15; // 15% surcharge example
    break;

Troubleshooting

Common Issues

  1. 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
  2. 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
  3. 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.