Skip to content
Gaurav TiwariDocs

Stackless for FluentCart Hooks and Filters Reference

Updated November 22, 2026

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) and number (1 to 100, default 20).
  • Each item has id, number, title, status, status_label, open, total, currency, due_date, admin_url and customer_url. Invoices also have issued_at and pay_url.
  • apply_filters('gtfc_invoice_admin_url', '', $id) and apply_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. $type is invoice, quote or affiliate.

More Hooks

HookTypeUse
gtfc/invoice_recurring_createdactionRuns once per billed period with ($invoice, $schedule).
gtfc/lifecycleactionEvery payload carries live: false on a staging copy, so listeners can avoid emailing or charging from it.
gtfc/live_storefilterDecide whether this site is the live store: ($live, $state). The GTFC_LIVE_STORE constant wins over it.
gtfc/live_store/heldactionRuns when a copy skips or holds something, with what it held.
gtfc/buy_link/cart_createdactionA buy link built its cart: ($cart, $items, $coupons).
gtfc/stripe/payment_intent_argsfilterChange the PaymentIntent Stripe (Stackless) creates. Stackless’s own metadata always wins.
gtfc/stripe/express_optionsfilterChange the Apple Pay, Google Pay and Link button options.
gtfc/stripe/webhookactionA verified Stripe event, before it is handled: ($type, $object, $mode).
gtfc/paypal/order_argsfilterChange the PayPal order PayPal (Stackless) creates.
gtfc/paypal/button_stylefilterChange the Smart Buttons’ style.
gtfc/paypal/webhookactionA verified PayPal event: ($type, $resource, $mode, $outcome).
gtfc_crm_*actionThe FluentCRM trigger events, each with the contact and the record.
gtfc/product_feed/itemfilterChange one Google Product Feed item before it is written: ($item, $variation, $post). Return null to leave it out.
gtfc/product_feed/builtactionRuns 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.

HookTypeUse
gtfc_stripe_managed_api_versionfilterThe 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_settingsfilterThe gateway’s saved settings when they load: ($settings).
gtfc_stripe_managed_tax_codefilterThe 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_reasonfilterWhy 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_digitalfilterWhether Stripe can sell a product as merchant of record: ($digital, $productId, $fulfillment). Digital products count, service products don’t.
gtfc_stripe_managed_billing_intervalsfilterMaps FluentCart billing intervals to Stripe: ($intervals), each as [period, count], such as 'quarterly' => ['month', 3]. Add custom intervals here.
gtfc_stripe_managed_session_argsfilterChange the Checkout Session body before it is created: ($body, $context), where $context has order, transaction and subscription.
gtfc_stripe_managed_pay_page_configfilterChange the pay page settings: ($config, $order, $transaction), with publishableKey, clientSecret, cancelUrl, testMode, accent and i18n. accent must be a hex color.
gtfc_stripe_managed_hiddenactionRuns when checkout hides the payment method for a cart: ($reason, $cart).
gtfc_stripe_managed_subscription_syncedactionRuns 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.

HookTypeUse
gtfc_sl_local_patternsfilterThe patterns that mark a site as local or staging: ($patterns), read from the module settings.
gtfc_sl_client_ipfilterThe client address used for rate limits: ($ip), REMOTE_ADDR by default. Behind a trusted proxy, return the real address.
gtfc_sl_allow_activationfilterRefuse 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_payloadfilterThe public license details in API responses: ($data, $license).
gtfc_sl_version_payloadfilterThe version route’s update response: ($data, $license, $productId).
gtfc_sl_info_payloadfilterThe info route’s details response: ($data, $productId, $license). $license is null when no key was sent.
gtfc_sl_generate_for_orderfilterReturn false to create no keys for a paid order: ($generate, $order).
gtfc_sl_generate_keyfilterReplace 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_failedfilterReturn false to keep an order’s keys when FluentCart reports a failed payment: ($revoke, $data).
gtfc_sl_release_public_keysfilterYour 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_createdactionA license was created: ($id, $row).
gtfc_sl_license_updatedactionA license was updated: ($id, $data), with the changed columns.
gtfc_sl_keys_createdactionA paid order got new keys: ($ids, $order).
gtfc_sl_order_revokedactionA full refund, cancellation or failed payment revoked an order’s keys: ($order, $count).
gtfc_sl_site_activatedactionA site was activated: ($licenseId, $site, $isLocal).
gtfc_sl_site_deactivatedactionA site was deactivated: ($licenseId, $siteUrl).
gtfc_sl_package_downloadactionRuns 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.

HookTypeUse
gtfc/gift_cards/hold_hoursfilterHours an unpaid order’s gift card money counts against other carts: ($hours), 24 by default, at least 1.
gtfc/billing_health/sourcesfilterBilling Health sections: ($sources), id => callable returning a label, issues, events and declines.
gtfc/billing_health/fixfilterRun a fix your source offers: ($result, $source, $fix).
gtfc/billing_health/fix_descriptionfilterThe confirmation text for your fix: ($description, $source, $fix).
gtfc/billing_health/card_update_urlfilterWhere the card-expiring email links: ($url, $subscription).
gtfc/billing_health/card_expiring_sentactionAfter a card-expiring email is sent: ($subscriptionId, $key).
gtfc/creem/settingsfilterCreem’s settings when they load: ($settings).
gtfc/creem/currenciesfilterCurrencies Creem is offered for: ($currencies). It can only narrow USD and EUR.
gtfc/creem/billing_intervalsfilterMaps FluentCart billing intervals to Creem’s.
gtfc/creem/checkout_argsfilterThe Creem checkout request: ($body, $context).
gtfc/creem/product_argsfilterA Creem product before it is created: ($body, $item, $billing, $mode).
gtfc/creem/webhookactionEach verified Creem event: ($type, $object, $mode).
gtfc/creem/subscription_syncedactionAfter a subscription is updated from Creem: ($subscription, $remote, $event).
gtfc/wholesale_pricing/viewer_rolesfilterWholesale roles a viewer is priced with: ($roles, $user).
gtfc/wholesale_pricing/skip_itemfilterLeave a cart line at its own price: ($skip, $item).
gtfc/wholesale_pricing/public_pricefilterThe store-currency price rules start from: ($price, $variation).
gtfc/wholesale_pricing/table_htmlfilterThe quantity table’s HTML: ($html, $rows).
gtfc/product_addons/line_start_pricefilterThe 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_displayfilterOne option’s price for the product page live total: ($row, $variation). A tiers list sets prices that drop with quantity.
gtfc/locked_price_ownersfilterModules 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_locked holds the name of the module that set the price, such as gtfc_pwyl for 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_pwyl stores the buyer’s chosen amount with its minimum, maximum and currency.
  • gtfc_addons marks a line priced by Product Add-ons, and other_info.gtfc_addons holds the choices and their charges.
  • gtfc_wholesale marks a line priced by Wholesale Pricing, and other_info.gtfc_wholesale holds the tier that priced it.
  • FluentCart’s own other_info.is_price_locked is 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.

Share

Was this helpful?

Still stuck? Open a support ticket