GT Extensions 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 GT Extensions 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, GT Extensions 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);
Native FluentCart Integration
GT Extensions 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.- 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.
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.