Skip to content

For Developers

[sales_booster_extras_frequently_bought_together]

Section titled “[sales_booster_extras_frequently_bought_together]”

Displays the Frequently Bought Together block.

[sales_booster_extras_frequently_bought_together]
[sales_booster_extras_frequently_bought_together product_id="123" template_variant="woocommerce_loop" display_type="slider" loop_columns="3"]

Supported attributes (current implementation):

  • product_id
  • limit
  • display_type (standard, slider)
  • layout_direction (vertical, horizontal)
  • template_variant (minimal, woocommerce_loop)
  • loop_columns
  • render_mode (server, ajax)
  • title
  • show_slider_dots
  • show_slider_arrows

Namespace:

/wp-json/sales-booster-extras/v1

Renders the FBT block HTML (used for AJAX render mode).

Query params:

  • product_id (required)
  • same render args as shortcode (optional), e.g. limit, display_type, template_variant, loop_columns, …

Response:

{
"html": "<section class=\"sbe-fbt ...\">...</section>"
}

Returns backfill/index status for the admin tools UI.

Requires capability: manage_options

Runs one backfill batch (or rebuild + first batch).

Body:

  • mode: backfill or rebuild
  • batch_size: integer
  • with_counts: boolean (optional; request full expensive counters)

Requires capability: manage_options

The module registers the fbt command.

Terminal window
wp fbt backfill --batch-size=300
Terminal window
wp fbt rebuild --batch-size=300

The recommendation index is stored in a custom table managed through WPify Model:

  • table (default prefix): wp_sales_booster_extras_fbt_index

It stores undirected pairs (one row per pair):

  • product_parent_id
  • related_parent_id
  • score
  • timestamps

Pairs are normalized as:

  • (min(productA, productB), max(productA, productB))

Scoring is stored on parent product level to keep the index compact and stable:

  • variations are normalized to the variable parent product
  • external and grouped products are ignored for indexing
  • child line items from bundles/composites/etc. are ignored (parent line item only)

Indexing runs on WooCommerce order status transitions:

  • processing
  • completed

The module uses Action Scheduler async jobs when available and falls back to synchronous processing.

The module stores internal order meta flags to avoid duplicate indexing:

  • _sbe_fbt_indexed_once
  • _sbe_fbt_index_queue_scheduled

These are handled with WooCommerce order meta APIs (HPOS-compatible).

Per-product FBT override data is stored in:

_sales_booster_extras_fbt

Structure (simplified):

[
'override_mode' => 'auto' | 'replace' | 'merge',
'manual_product_ids' => [12, 34, 56],
]

Examples:

  • .sbe-fbt - root container
  • .sbe-fbt__title - heading
  • .sbe-fbt__viewport - scroll/Embla viewport
  • .sbe-fbt__list - minimal list
  • .sbe-fbt__list--woocommerce - WooCommerce loop list
  • .sbe-fbt__dots, .sbe-fbt__dot - slider pagination
  • .sbe-fbt__arrows, .sbe-fbt__arrow - slider arrows

State/variant classes:

  • .sbe-fbt--standard
  • .sbe-fbt--slider
  • .sbe-fbt--template-minimal
  • .sbe-fbt--template-woocommerce_loop
  • .sbe-fbt--columns-1 to .sbe-fbt--columns-6