Stackless for FluentCart Hooks and Filters Reference
Use WordPress hooks to adapt a specific behavior without editing the plugin’s files. A filter returns a modified value; an action observes an event or performs follow-up work.
Choose the smallest supported extension point for the task. Payment validation, invoice state and delivery capacity should remain in the normal server workflow rather than being replaced by a browser-only customization.
Plugin Extension Points
These hooks are defined by Stackless for FluentCart itself.
- gt_extensions_fluentcart/free_price_text filters the replacement text for zero prices.
- gt_extensions_fluentcart/free_price_text/load_assets permits assets for a custom template outside the detected commerce surfaces.
- gt_extensions_fluentcart/sold_count receives the count and product ID for a custom count source. It runs on the real count, before the Count multiplier is applied.
- gt_extensions_fluentcart/external_product_redirect receives destination URL, product ID and variation ID before the supported legacy external redirect.
- gtfc/multi_currency/gateway_capabilities filters the gateway capability hints shown in settings.
- gtfc/multi_currency/location_country filters the detected country with its context.
- gtfc/multi_currency/location_currency filters the mapped currency and country.
- gtfc/multi_currency/load_frontend_assets provides an explicit asset-loading override for legacy or custom integrations.
- gtfc/multi_currency/checkout_selector receives true and the cart. Return false to hide the checkout currency picker for that cart. A picker placed with the shortcode is not affected.
- gtfc/extra/hidden_country receives the two-letter country code and the cart when Checkout Enhancements hides the country field on a free or digital order. Return another code to change the country saved on the order, or an empty string to show the country field instead.
- gtfc_checkout_cache_buster_enabled filters whether the cache-buster behavior is enabled.
- gtfc/invoice_cart_created receives the native cart created for an invoice.
Example: Change the Free Label
Put a small customization in an appropriate site plugin or managed snippet, then check a zero-price product.
add_filter('gt_extensions_fluentcart/free_price_text', function ($text) {
return 'Complimentary';
});
This changes the display label. It does not change the numeric product price or bypass checkout.
Example: Set the Country for Hidden-Country Orders
When the shorter checkout hides the country, Stackless picks one from the cart, the buyer’s Cloudflare location, FluentCart’s own value or your store country. A store that sells only inside India can save IN on every such order:
add_filter('gtfc/extra/hidden_country', function ($country, $cart) {
return 'IN';
}, 10, 2);
The value is uppercased and saved as the billing country. It only applies to orders where the country field is hidden; carts that ship, and paid orders while FluentCart’s tax is on, keep the field the buyer fills in.
To keep the currency picker off checkout for carts with a subscription, for example:
add_filter('gtfc/multi_currency/checkout_selector', function ($show, $cart) {
if (is_object($cart) && method_exists($cart, 'hasSubscription') && $cart->hasSubscription()) {
return false;
}
return $show;
}, 10, 2);
Invoices and Quotes for Other Plugins
Help desks and account pages can list a customer’s invoices and quotes without reading Stackless’s tables. Both functions return an empty array when their module is off:
$invoices = gtfc_get_customer_invoices(get_current_user_id(), '', ['open' => true, 'number' => 10]);
$quotes = gtfc_get_customer_quotes(get_current_user_id());
- Arguments: the user ID, an extra email (for guests), and
open(only open items) andnumber(1 to 100, default 20). - Each item has
id,number,title,status,status_label,open,total,currency,due_date,admin_urlandcustomer_url. Invoices also haveissued_atandpay_url. apply_filters('gtfc_invoice_admin_url', '', $id)andapply_filters('gtfc_quote_admin_url', '', $id)return the admin screen for an invoice or quote.do_action('gtfc_account_item_actions', $type, $id, $data)runs on the customer invoice page, the proposal page and the Refer & Earn tab, so you can add a “Get help” button there.$typeisinvoice,quoteoraffiliate.
More Hooks
| Hook | Type | Use |
|---|---|---|
gtfc/invoice_recurring_created | action | Runs once per billed period with ($invoice, $schedule). |
gtfc/lifecycle | action | Every payload carries live: false on a staging copy, so listeners can avoid emailing or charging from it. |
gtfc/live_store | filter | Decide whether this site is the live store: ($live, $state). The GTFC_LIVE_STORE constant wins over it. |
gtfc/live_store/held | action | Runs when a copy skips or holds something, with what it held. |
gtfc/buy_link/cart_created | action | A buy link built its cart: ($cart, $items, $coupons). |
gtfc/stripe/payment_intent_args | filter | Change the PaymentIntent Stripe (Stackless) creates. Stackless’s own metadata always wins. |
gtfc/stripe/express_options | filter | Change the Apple Pay, Google Pay and Link button options. |
gtfc/stripe/webhook | action | A verified Stripe event, before it is handled: ($type, $object, $mode). |
gtfc/paypal/order_args | filter | Change the PayPal order PayPal (Stackless) creates. |
gtfc/paypal/button_style | filter | Change the Smart Buttons’ style. |
gtfc/paypal/webhook | action | A verified PayPal event: ($type, $resource, $mode, $outcome). |
gtfc_crm_* | action | The FluentCRM trigger events, each with the contact and the record. |
gtfc/product_feed/item | filter | Change one Google Product Feed item before it is written: ($item, $variation, $post). Return null to leave it out. |
gtfc/product_feed/built | action | Runs after each feed build with the build summary: items, products and what was left out. |
On-page Checkout’s design shortcode attribute and the data-gtfc-frame-keep attribute are covered in the On-page Checkout guide.
Stripe Managed Payments Hooks
These hooks belong to the Stripe Managed Payments gateway, where Stripe is the merchant of record for digital products.
| Hook | Type | Use |
|---|---|---|
gtfc_stripe_managed_api_version | filter | The Stripe API version the gateway pins: ($version), 2025-03-31.basil by default. A value that isn’t a Stripe version keeps the default. |
gtfc_stripe_managed_settings | filter | The gateway’s saved settings when they load: ($settings). |
gtfc_stripe_managed_tax_code | filter | The Stripe tax code for a payment: ($code, $order). Return a txcd_ code with 8 digits; anything else keeps the code from the settings. |
gtfc_stripe_managed_cart_reason | filter | Why a cart can’t use the gateway: ($reason, $cart). An empty string shows the payment method; physical, too_many_subscriptions or any other reason hides it. |
gtfc_stripe_managed_is_digital | filter | Whether Stripe can sell a product as merchant of record: ($digital, $productId, $fulfillment). Digital products count, service products don’t. |
gtfc_stripe_managed_billing_intervals | filter | Maps FluentCart billing intervals to Stripe: ($intervals), each as [period, count], such as 'quarterly' => ['month', 3]. Add custom intervals here. |
gtfc_stripe_managed_session_args | filter | Change the Checkout Session body before it is created: ($body, $context), where $context has order, transaction and subscription. |
gtfc_stripe_managed_pay_page_config | filter | Change the pay page settings: ($config, $order, $transaction), with publishableKey, clientSecret, cancelUrl, testMode, accent and i18n. accent must be a hex color. |
gtfc_stripe_managed_hidden | action | Runs when checkout hides the payment method for a cart: ($reason, $cart). |
gtfc_stripe_managed_subscription_synced | action | Runs after a FluentCart subscription is brought in line with Stripe: ($subscription, $remote, $event), where $remote is the Stripe subscription and $event the Stripe event type, or resync. |
Software Licensing Hooks
These hooks belong to Software Licensing. A $license argument is the license record as an array.
| Hook | Type | Use |
|---|---|---|
gtfc_sl_local_patterns | filter | The patterns that mark a site as local or staging: ($patterns), read from the module settings. |
gtfc_sl_client_ip | filter | The client address used for rate limits: ($ip), REMOTE_ADDR by default. Behind a trusted proxy, return the real address. |
gtfc_sl_allow_activation | filter | Refuse an activation: ($allowed, $license, $site, $isLocal). Return a WP_Error to block it; its code and message go back to the client, with the status from its data (403 by default). |
gtfc_sl_payload | filter | The public license details in API responses: ($data, $license). |
gtfc_sl_version_payload | filter | The version route’s update response: ($data, $license, $productId). |
gtfc_sl_info_payload | filter | The info route’s details response: ($data, $productId, $license). $license is null when no key was sent. |
gtfc_sl_generate_for_order | filter | Return false to create no keys for a paid order: ($generate, $order). |
gtfc_sl_generate_key | filter | Replace a new license key: ($key, $config, $data), where $config is the product’s licensing settings and $data the license being created. Keys must be unique. |
gtfc_sl_revoke_on_payment_failed | filter | Return false to keep an order’s keys when FluentCart reports a failed payment: ($revoke, $data). |
gtfc_sl_release_public_keys | filter | Your Ed25519 public keys as key_id => 64-character hex: ($keys). A pasted release signature is checked against them before it is saved. |
gtfc_sl_license_created | action | A license was created: ($id, $row). |
gtfc_sl_license_updated | action | A license was updated: ($id, $data), with the changed columns. |
gtfc_sl_keys_created | action | A paid order got new keys: ($ids, $order). |
gtfc_sl_order_revoked | action | A full refund, cancellation or failed payment revoked an order’s keys: ($order, $count). |
gtfc_sl_site_activated | action | A site was activated: ($licenseId, $site, $isLocal). |
gtfc_sl_site_deactivated | action | A site was deactivated: ($licenseId, $siteUrl). |
gtfc_sl_package_download | action | Runs before a package download is served: ($license, $productId, $package, $version). $version is empty for the current release. |
Gift Cards, Billing Health, Creem, Wholesale Pricing and Add-ons Hooks
Each module’s page explains these in context: Gift Cards and Store Credit, Billing Health, Creem and Wholesale Pricing. Purchase Rules’ country-lock filters are on the Purchase Rules page.
| Hook | Type | Use |
|---|---|---|
gtfc/gift_cards/hold_hours | filter | Hours an unpaid order’s gift card money counts against other carts: ($hours), 24 by default, at least 1. |
gtfc/billing_health/sources | filter | Billing Health sections: ($sources), id => callable returning a label, issues, events and declines. |
gtfc/billing_health/fix | filter | Run a fix your source offers: ($result, $source, $fix). |
gtfc/billing_health/fix_description | filter | The confirmation text for your fix: ($description, $source, $fix). |
gtfc/billing_health/card_update_url | filter | Where the card-expiring email links: ($url, $subscription). |
gtfc/billing_health/card_expiring_sent | action | After a card-expiring email is sent: ($subscriptionId, $key). |
gtfc/creem/settings | filter | Creem’s settings when they load: ($settings). |
gtfc/creem/currencies | filter | Currencies Creem is offered for: ($currencies). It can only narrow USD and EUR. |
gtfc/creem/billing_intervals | filter | Maps FluentCart billing intervals to Creem’s. |
gtfc/creem/checkout_args | filter | The Creem checkout request: ($body, $context). |
gtfc/creem/product_args | filter | A Creem product before it is created: ($body, $item, $billing, $mode). |
gtfc/creem/webhook | action | Each verified Creem event: ($type, $object, $mode). |
gtfc/creem/subscription_synced | action | After a subscription is updated from Creem: ($subscription, $remote, $event). |
gtfc/wholesale_pricing/viewer_roles | filter | Wholesale roles a viewer is priced with: ($roles, $user). |
gtfc/wholesale_pricing/skip_item | filter | Leave a cart line at its own price: ($skip, $item). |
gtfc/wholesale_pricing/public_price | filter | The store-currency price rules start from: ($price, $variation). |
gtfc/wholesale_pricing/table_html | filter | The quantity table’s HTML: ($html, $rows). |
gtfc/product_addons/line_start_price | filter | The unit price an add-on line starts from, before add-on charges: ($price, $context), where the context holds the item, cart, variation, quantity and currency. Wholesale Pricing answers it with the buyer’s tier price. |
gtfc/product_addons/variation_display | filter | One option’s price for the product page live total: ($row, $variation). A tiers list sets prices that drop with quantity. |
gtfc/locked_price_owners | filter | Modules that lock cart line prices, by the marker they leave in other_info.gtfc_price_locked: ($owners), each with its module key and the other_info keys it keeps. |
Native FluentCart Integration
Stackless also attaches to FluentCart’s own hooks. These are useful landmarks when tracing a behavior in source.
- Price display uses fluent_cart/single_product/variation_price and fluent_cart/cart/estimated_total.
- Sold-count, stock and quantity messages use fluent_cart/product/after_price.
- Quantity limits and restricted purchasing use fluent_cart/cart/can_purchase.
- Button labels use fluent_cart/product/add_to_cart_text and fluent_cart/product/buy_now_text.
- Checkout price conversion uses native cart pricing and checkout validation hooks.
- Add-ons use fluent_cart/cart/fees for native fee handling.
- Wishlists and stock alerts render beside supported single-product actions.
- Saved carts register a native customer-portal endpoint and menu item.
- Service products integrate with product saving, receipt instructions and the digital-order completion decision.
Cart Line Markers
Some modules set a cart line’s price themselves. They mark the line in its other_info so other code knows to leave that price alone:
other_info.gtfc_price_lockedholds the name of the module that set the price, such asgtfc_pwylfor Pay What You Like. Multi-Currency Checkout’s stale-price check skips these lines instead of resetting them to the catalog price.other_info.gtfc_pwylstores the buyer’s chosen amount with its minimum, maximum and currency.gtfc_addonsmarks a line priced by Product Add-ons, andother_info.gtfc_addonsholds the choices and their charges.gtfc_wholesalemarks a line priced by Wholesale Pricing, andother_info.gtfc_wholesaleholds the tier that priced it.- FluentCart’s own
other_info.is_price_lockedis set to yes on the same lines.
If your own code re-prices cart lines, check for gtfc_price_locked first and skip the line when it is set. Otherwise a buyer’s chosen amount can be overwritten before checkout.
When the module that locked a line is switched off, Stackless takes the lock and the module’s marker off the line on the next cart change and lets FluentCart price it from the catalog. At place order such a line is priced again and the order is refused once with FluentCart’s “Some prices in your cart have changed” message. Register your own locking module with gtfc/locked_price_owners so it gets the same guard.
Keep Customizations Maintainable
Preserve argument counts and return types. Pass an existing WP_Error through a validation filter instead of overwriting another check’s failure. Keep network calls and large queries out of frequently rendered price filters where possible.
Frontend files are generated from the asset source and served minified. Run npm run build after changing JavaScript or CSS in a development copy; do not edit only a generated file. For request-based integrations, use the REST reference. The REST namespace and code identifiers in these lessons are interface names, not a release requirement.