Skip to main content

Product Recommendations

Goal​

Suggest products a shopper is likely to want, from what shoppers actually do on the store rather than from hand-picked upsell lists. Interactions are recorded, scores are recalculated on a schedule, and three strategies are blended into one ranking.

Tier and entitlement​

FieldValue
TierPremium
Entitlement keyrecommendations
Admin tabrecommendations
Module keyrecommendations
Settings prefixaiowc_rec_

registerHooks() guards itself twice over: it returns early if the licence does not allow the module, and again if enable_recommendations is off. The registry's own enabled-and-entitled check applies before either.

How the ranking works​

Three services produce scores, which Service/RecommendationEngine.php blends by weight and filters by a minimum score:

StrategyServiceBasis
CollaborativeCollaborativeFilteringServiceProducts interacted with by shoppers who interacted with this one
Content-basedContentBasedServiceProduct attributes and taxonomy overlap
TrendingTrendingAnalysisServiceInteraction volume over the last 24 hours

Each strategy is asked for three times the requested number of candidates, the results are combined by weight, anything below min_score_threshold is dropped, and the blended result is cached for cache_duration seconds.

Settings​

Read through ModuleSettings with the aiowc_rec_ prefix; defaults are RecommendationsModule::DEFAULTS. There is no settings REST endpoint — the module registers none, so these values are changed through the options they are stored in.

SettingDefaultMeaningConsumed
enable_recommendationstrueMaster switch; off means no hooks register at allYes
collaborative_weight40Weight of the collaborative scoreYes
content_based_weight30Weight of the content-based scoreYes
trending_weight30Weight of the trending scoreYes
min_score_threshold0.3Blended score below which a candidate is droppedYes
cache_duration3600Seconds a blended result is cachedYes
interaction_days90Age at which interaction rows are prunedYes — passed to the cleanup job
show_on_product_pagetrueWhether the product-page rails renderYes — decides whether the hook is added at all
show_on_carttrueWhether the cart cross-sells renderYes — decides whether the hook is added at all
max_recommendations8Intended cap on items shownNo — never read; the handlers pass a literal 8
show_on_homepagetrueIntended homepage placementNo — never read, and no homepage hook exists

Admin screen​

Admin tab recommendations. It reads the trending and per-product recommendation endpoints and offers the manual refresh action.

Database schema​

Created by Schema/RecommendationsSchema.php at schema version 1.0.0.

TableHolds
{prefix}aiowc_recommendation_viewsProduct views feeding the strategies
{prefix}aiowc_recommendation_interactionsInteractions of other types, including purchases
{prefix}aiowc_recommendation_scoresScores written by the recalculation job
{prefix}aiowc_recommendation_cacheCached blended results, keyed by algorithm

REST endpoints​

Namespace aiowc/v1. All responses use the shared envelope.

MethodPathPurposeRequired argsPermission
GET/recommendations/{product_id}Recommendations for one product, up to limitproduct_idRate-limited public read
GET/recommendations/personalizedRecommendations for the caller, up to limit—Rate-limited public read
GET/recommendations/trendingTrending products, up to limit—Rate-limited public read
POST/recommendations/trackRecord an interaction of the given typeproduct_id, typePublic write check
POST/recommendations/refreshRecalculate scores now—Manage

WooCommerce integration​

HookPriorityEffect
woocommerce_after_single_product_summary15Renders two rails — "Frequently bought together" and "You may also like" — and records a view. Added only when show_on_product_page is on
woocommerce_cart_collaterals20Renders cart cross-sells. Added only when show_on_cart is on
woocommerce_order_status_completed10Records a purchase interaction for the order's products

Shortcodes​

ShortcodePurpose
[aiowc_recommendations]Renders a recommendations rail
[aiowc_trending]Renders the trending rail

No block is registered.

Background jobs​

All three run on the WordPress cron scheduler.

HookSchedulePurpose
aiowc_recommendations_calculateEvery 6 hours, via the custom aiowc_every_6_hours interval the job registersRecalculates scores over the last 90 days of history
aiowc_trending_updateHourlyRecomputes the trending list over a 24-hour window, normalises the scores and caches them for an hour
aiowc_recommendations_cleanupDailyPrunes interaction rows older than interaction_days

The 90-day history window used by the recalculation job is a constant in the job, separate from the interaction_days setting the cleanup job uses.

Entitlement limits​

The recommendations entitlement gates the module, and registerHooks() re-checks it before doing anything. No quota on tracked interactions or generated recommendations is implemented.