Skip to main content

Options

Fast Simon AC support customization options via JS variable object __fast_options.

Available Options

OptionDescriptionTypeDefaultExample
"with_product_attributes"Include product attributes in resultsbooleanfalsetrue
"with_product_variants"Include product variants in resultsbooleanfalsetrue
"max_ac_products_mobile"Max products on mobilenumber5false
"max_ac_products_tablet"Max products on tabletnumber5false
"max_ac_products_desktop"Max products on desktopnumber5false
"display_popular_on_empty_term"Show popular results when the input is emptybooleantruefalse
"display_popular_on_no_results"Show popular results when no matches are foundbooleanfalsetrue
"mobileMedieaQuery"Set mobile breakpoint{maxWidth: number}{maxWidth: 767}{maxWidth: 600}
"tabletMedieaQuery"Set tablet breakpoint{minWidth: number, maxWidth: number}{minWidth: 768, maxWidth: 1024}{minWidth: 600, maxWidth: 999}
"desktopMedieaQuery"Set desktop breakpoint{minWidth: number}{minWidth: 1025}{minWidth: 1000}
"full_spa"Enable for Single Page Applications (SPA)booleanfalsetrue
"forceOpenAlways"Keep autocomplete open at all timesbooleanfalsetrue
"is_chatbot"Enable chatbot modebooleanfalsetrue
"fs_avoid_inject_on_interaction"Inject AC script immediately (Shopify use case)booleanfalsetrue
"disable_ac_shadow_root"Disable Shadow DOM in autocomplete renderingbooleanfalsetrue
"parseAcProductTitle"Custom function for parsing product titles(title:string, productData?:productData)=>stringundefinedSee examples below
"parseAcProductPrice"Custom function for parsing product prices(price:string, productData?:productData)=>stringundefinedSee examples below
"parseAcProductCompare"Custom function for parsing compare-at prices(compare:string, productData?:productData)=>stringundefinedSee examples below
"avoid_bigcommerce_jwt_logged_on_user_check"Avoid checking JWT token for logged-in BigCommerce usersbooleanfalsetrue

How to add custom options:

Add the __fast_options variable to your HTML head within a script tag, for example:

<script>
var __fast_options = __fast_options || {};
__fast_options.max_ac_products_desktop = 5;
__fast_options.max_ac_products_tablet = 3;
__fast_options.max_ac_products_mobile = 2;
__fast_options.with_product_attributes = true;
__fast_options.parseAcProductTitle=(title)=>{
return title.replaceAll(" ",",");
};
</script>

Parse Functions with Product Data (Enhanced)

The parse functions (parseAcProductTitle, parseAcProductPrice, parseAcProductCompare) now accept an optional second parameter productData that contains the complete product object. This allows for more sophisticated customization based on product attributes.

Basic Examples (Backward Compatible)

// Simple title transformation - only using first parameter
__fast_options.parseAcProductTitle = function(title) {
return title.toUpperCase();
};

// Simple price formatting - only using first parameter
__fast_options.parseAcProductPrice = function(price) {
return "$" + price;
};

Advanced Examples with Product Data

// Add SKU to price display
__fast_options.parseAcProductPrice = function(price, productData) {
if (productData && productData.sku) {
return price + " (SKU: " + productData.sku + ")";
}
return "$" + price;
};

// Add vendor/brand to product title
__fast_options.parseAcProductTitle = function(title, productData) {
if (productData && productData.v) {
return title + " by " + productData.v;
}
return title;
};

// Enhanced compare price with discount percentage
__fast_options.parseAcProductCompare = function(comparePrice, productData) {
if (!comparePrice) return "";

if (productData && productData.p) {
// Calculate discount percentage
var discount = Math.round((1 - (parseFloat(productData.p) / parseFloat(comparePrice))) * 100);
if (discount > 0) {
return "Was: " + comparePrice + " (Save " + discount + "%)";
}
}
return "Was: " + comparePrice;
};

Available Product Data Fields

The productData parameter contains the following fields:

FieldDescriptionTypeExample
idProduct IDstring"prod_123"
skuProduct SKUstring"SKU-001"
lProduct label/titlestring"Blue T-Shirt"
pCurrent pricestring"29.99"
p_cCompare/original pricestring"39.99"
p_minMinimum price (variants)string"25.99"
p_maxMaximum price (variants)string"35.99"
cCurrencystring"USD"
dDescriptionstring"Comfortable cotton..."
vVendor/brandstring"Nike"
tPrimary thumbnail URLstring"https://..."
uProduct URLstring"/products/blue-tshirt"
isoIs on salebooleantrue
reviewAverage review ratingnumber4.5
reviews_countNumber of reviewsnumber125

Important Notes

  1. Backward Compatibility: The productData parameter is optional. Existing implementations will continue to work.

  2. Null Safety: Always check if productData exists before accessing its properties:

    if (productData && productData.sku) {
    // Safe to use productData.sku
    }
  3. Performance: These functions are called for each product, so keep them efficient.

Use Cases

  • B2B Stores: Display SKU prominently for business customers
  • Multi-Brand Stores: Show vendor/brand in product titles
  • Sale Promotions: Calculate and display discount percentages
  • Custom Badges: Add "New", "Sale", or "Limited" badges based on product data
  • Review Integration: Show ratings or review counts in autocomplete