Purchase Rules
Purchase Rules limits who can buy a product or variation. Everyone still sees it, and a buyer who doesn’t qualify sees the reason. Use it for courses with prerequisites, member-only products, or anything a customer should only buy once.
It can also lock products to countries, store-wide or per product and variation, by the visitor’s location or by the billing and shipping country. Use a country lock for licenses you can only sell in some countries, or for goods you can’t ship everywhere.
Set a Rule
- Go to FluentCart → Stackless and switch on Purchase Rules on the Dashboard.
- Open a product in FluentCart and choose Purchase rules from its menu.
- Tick Limit who can buy this product, choose the conditions and click Save.

A rule can use any mix of these:
- WordPress roles
- FluentCRM tags
- WP Fusion tags
- A repeat-purchase limit for the same variation
Under A buyer needs, choose whether any one of the roles and tags is enough or the buyer needs all of them. Leave roles and tags empty to limit repeat purchases only. A rule’s own message replaces the default refusal text, which you can change in the module settings.
Rules for Variations
Each variation follows one of three settings. Its own rule replaces the product rule.
- Uses the product rule: the default.
- Anyone can buy it: no restriction, even when the product has a rule.
- Has its own rule: its own roles, tags, repeat limit and message.

Lock Products to Countries
A country rule says Sell only to these countries or Sell everywhere except these countries, with a list of countries. European Union (all member states) at the top of the list covers every EU country at once. Hold Ctrl or Cmd to choose several. Once saved, the chosen countries are named under the list.
Each rule also says what to Check, one or more of:
- Visitor location (from your CDN’s country header): the country your CDN or server reports for the visitor.
- Billing country: the country on the order’s billing address.
- Shipping country (physical products): the shipping country, for carts that ship.
Store-Wide Country Lock
Open Purchase Rules under Stackless → Settings. Store-wide country lock applies to every product. Choose the rule, the countries and the checks, add an optional Message when refused and click Save changes. Leave the countries empty for no store-wide lock.
A Product or Variation’s Own Lock
On a product’s Purchase rules screen, the Countries panel sets Countries for this product:
- Uses the store-wide country rule: the default.
- Has its own country rule: its own rule, countries, checks and message.
- No country lock: anyone can buy it from anywhere, even with a store-wide lock.
Products with several variations also get Countries for this variation in each variation’s panel: Uses the product’s country rule, Has its own country rule or No country lock. Only the nearest rule applies: the variation’s, then the product’s, then the store-wide one.
How Countries Are Checked
- Visitor location is checked when the product is added to a cart, in instant, modal and on-page checkout, and when the order is placed. It is never checked on the product page, so product pages look the same in every country and cached pages stay correct. A refused buyer sees the reason when they try to buy.
- Billing and shipping country trim the checkout’s country list to the countries every product in the cart allows. The country field shows even where your checkout would leave it out. The order is checked again when it’s placed, saved addresses included.
- When no country fits every product in the cart, the buyer is asked to remove one of them.
- Country locks work for guests too. They don’t need an account.
Visitor Location Settings
The same settings screen has a Visitor location section. It shows what this request’s headers say, such as “Your country on this request: DE, from Cloudflare.” If your CDN sends no country, turn on its country header (in Cloudflare, IP Geolocation).
- Detection: Automatic: CDN and server headers (Cloudflare, CloudFront, Vercel, App Engine, GeoIP server modules and common proxy headers), Cloudflare header only, or My own header only.
- Custom header: a request header your proxy sets to the visitor’s two-letter country code, such as
X-Country-Code. - Country unknown: Let them buy (the default) or Treat as not allowed, for visitors with no country header, such as no CDN, Tor or a local request. Address checks aren’t affected.
A visitor’s location can be changed with a VPN, and if your server can be reached without the CDN, the header can be faked. Add a billing or shipping check where the lock matters.
Country Messages
The module settings hold the default refusal texts. A rule’s own Message when refused replaces the visitor-location and address messages for that rule.
| Setting | Default |
|---|---|
| Message when the visitor’s country is not allowed | “{product}” is not available in your country. |
| Message when the billing or shipping country is not allowed | “{product}” can’t be sold to {country}. |
| Message when no country is given | Choose your country to buy “{product}”. |
| Message when no country fits the whole cart | The items in your cart can’t be bought from the same country. Remove one of: {products}. |
{product} is the product name, {country} the country name and {products} the products that can’t share a country.
What Buyers See
In On-page Checkout, a refused plan stays listed and turned off, with the reason. Plans from several products can share one list:
[gtfc_checkout plans="34,35,36"]

On a product page, a refused variation is turned off with the reason, and the selection moves to one the buyer can have. When no variation is open, the buttons are removed and the reason takes their place.

Where Rules Are Checked
The rule runs for the current user at each of these points, so a direct link won’t get around it:
- Adding to a cart
- Instant, modal and on-page checkout, including direct links, with Stock Management on or off
- Switching a checkout line to another product or variation
- Placing the order, so a buyer who loses a tag after opening a checkout is still refused
Country locks by visitor location skip the product page; see Lock Products to Countries.
Paying Again for an Unpaid Order
A buyer who doesn’t qualify can’t place their unpaid order again from their own cart, for example after a failed payment. That cart is checked like a new purchase, country locks included, and so is a plan upgrade.
These still go through, because your store or FluentCart issued them:
- Invoices and their payment links.
- Pay-for-order links, which are FluentCart’s payment links for existing orders.
- Subscription renewals and reactivations.
- Early installment payments.
A payment link works for any unpaid order with an amount due, including one placed before you set the rule, so look through your unpaid orders when you do. To stop a link, cancel the order and then delete it, which can’t be undone. Canceling alone doesn’t close the link.
Course Prerequisites
FluentCart only knows what someone bought, not what they finished. To require Course 1 before Course 2, have your course plugin or an automation apply a tag when a student finishes Course 1, then put that tag on the rule for Course 2. For a course that needs two earlier ones, add both tags and choose all of them under A buyer needs.
Good to Know
- Guests: any role, tag or repeat-purchase rule requires login, because roles, tags and past orders can’t be checked without an account. Country locks don’t need an account.
- Already bought: this means a paid order for the same variation, under the account’s customer record or its email. Unpaid orders and fully refunded lines don’t count.
- Courses that expire: the repeat limit counts any paid order, however old. If students can buy a course again after it expires, leave the limit off for that course.
- Missing plugins: if FluentCRM or WP Fusion is deactivated, its tags count as missing, so the restriction stays closed unless another condition passes.
- WP Fusion tags: the rule reads WP Fusion’s saved copy of the user’s tags, so a page view makes no CRM request. FluentCRM on the same site updates that copy at once. An external CRM updates it when WP Fusion syncs, so set up its webhooks if a tag must open a course right away.
- Turning the module off: anyone can buy these products again. Your rules stay saved.
For Developers
gtfc/purchase_rules/result changes the answer for one buyer. It receives an empty string, login, denied, owned, country (visitor location) or address (billing or shipping country), then the rule, the variation ID and the user ID. Return an empty string to allow the purchase:
add_filter('gtfc/purchase_rules/result', function ($result, $rule, $variationId, $userId) {
return user_can($userId, 'manage_options') ? '' : $result;
}, 10, 4);
Country locks have their own hooks:
| Hook | Type | Use |
|---|---|---|
gtfc/purchase_rules/country_rule | filter | The country rule that governs a variation: ($rule, $productId, $variationId). Return null for no lock. |
gtfc/purchase_rules/country | filter | The visitor’s two-letter country: ($country, $source). Use it on a site without a country header. |
gtfc/purchase_rules/geo_sources | filter | The request variables read for the visitor’s country, in order: ($sources). |
gtfc/purchase_rules/country_groups | filter | Country groups usable in a rule, like EU: ($groups). |