Skip to content

feat(tax): implement universal tax as 'Apply to all countries' option in Tax Rates page#456

Merged
superdav42 merged 1 commit intomainfrom
feature/issue-455-universal-tax-all-countries
Mar 25, 2026
Merged

feat(tax): implement universal tax as 'Apply to all countries' option in Tax Rates page#456
superdav42 merged 1 commit intomainfrom
feature/issue-455-universal-tax-all-countries

Conversation

@superdav42
Copy link
Collaborator

Summary

Implements the 'Apply to all countries' universal tax fallback feature requested in issue #455.

What was already implemented

After reviewing the codebase, the core feature was already present:

  • views/taxes/list.php — Country dropdown already includes <option value="*">Apply to all countries</option> as the first option
  • inc/functions/tax.phpwu_get_applicable_tax_rates() already has fallback logic: when no country-specific rate matches, any rate with country='*' is applied as a universal fallback
  • lang/ultimate-multisite.pot — "Apply to all countries" string already present at line 22517

This is the correct dropdown-option approach requested by the maintainer (not the separate settings toggle approach from closed PR #277).

What this PR adds

Tests (tests/WP_Ultimo/Functions/Tax_Functions_Test.php) — 5 new test cases covering the '*' wildcard country behavior:

  1. test_get_applicable_tax_rates_returns_wildcard_as_fallback — wildcard rate returned when no country-specific match
  2. test_get_applicable_tax_rates_country_specific_takes_precedence_over_wildcard — per-country rates take precedence
  3. test_get_applicable_tax_rates_wildcard_not_returned_when_country_matches — wildcard excluded when country matches
  4. test_get_applicable_tax_rates_wildcard_applies_to_any_unmatched_country — wildcard applies to any unmatched country (BR, JP, AU, CA)
  5. test_get_applicable_tax_rates_empty_when_no_match_and_no_wildcard — empty result when no match and no wildcard

Acceptance criteria

  • 'Apply to all countries' option appears in country dropdown on Tax Rates page
  • Selecting it applies the rate universally as a fallback
  • Existing per-country rates still take precedence
  • Translations updated for new strings (already in POT file)

Reference

Adds unit tests for the '*' country wildcard fallback behavior in
wu_get_applicable_tax_rates(), covering:
- Wildcard rate returned as fallback when no country-specific match
- Per-country rates take precedence over wildcard rates
- Wildcard not returned when a country-specific rate matches
- Wildcard applies to any unmatched country
- Empty result when no match and no wildcard configured

The feature itself (dropdown option + fallback logic + POT string) was
already implemented in views/taxes/list.php, inc/functions/tax.php, and
lang/ultimate-multisite.pot.

Closes #455
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 25, 2026

Warning

Rate limit exceeded

@superdav42 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 3 minutes and 5 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cbf23899-0a03-448d-b7a3-4e29da7bcb79

📥 Commits

Reviewing files that changed from the base of the PR and between 6b453aa and 365377a.

📒 Files selected for processing (1)
  • tests/WP_Ultimo/Functions/Tax_Functions_Test.php
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/issue-455-universal-tax-all-countries

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

🔨 Build Complete - Ready for Testing!

📦 Download Build Artifact (Recommended)

Download the zip build, upload to WordPress and test:

🌐 Test in WordPress Playground (Very Experimental)

Click the link below to instantly test this PR in your browser - no installation needed!
Playground support for multisite is very limitied, hopefully it will get better in the future.

🚀 Launch in Playground

Login credentials: admin / password

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(tax): implement universal tax as 'Apply to all countries' option in Tax Rates page

1 participant