Product availability is a business rule, not just a catalog attribute. A recommendation that sends a shopper to an unavailable product creates friction, reduces trust, and can distort performance reporting. In a WooCommerce implementation using Amazon Personalize, availability should therefore be synchronized, enforced at request time, and handled gracefully when the catalog changes faster than the recommendation system.
Define the availability policy first
Before changing the integration, agree on which products are eligible for each placement. A simple policy might be:
- Do not recommend products with a WooCommerce stock status of
outofstock. - Do not recommend products that are not purchasable because they are unavailable for the current location or customer group.
- Allow backordered products only in placements where the expected shipping delay is clearly communicated.
- Exclude products that are disabled, private, deleted, or outside the current sales channel.
This policy should be shared by the product feed, the Amazon Personalize item dataset, and the final WooCommerce rendering layer. Treating stock as a presentation concern only will eventually produce inconsistent results.
Represent availability in the item dataset
The Amazon Personalize Items dataset should contain the fields needed to identify eligible products. For example, an item record can include an item identifier, product type, categories, price bands, and a categorical availability field such as IN_STOCK, BACKORDER, or OUT_OF_STOCK.
ITEM_ID,PRODUCT_TYPE,CATEGORY_L1,AVAILABILITY,IS_PUBLISHED
SKU-1001,variable,Accessories,IN_STOCK,true
SKU-1002,simple,Accessories,OUT_OF_STOCK,true
SKU-1003,simple,Accessories,BACKORDER,true
Use the identifier that your WooCommerce integration can resolve reliably. For variable products, decide whether recommendations represent the parent product or an individual variation. If the recommendation points to a parent product, aggregate availability according to the storefront rule: for example, mark the parent as available when at least one purchasable variation is in stock.
Boolean-like fields are often easier to manage as categorical values. Keep the vocabulary small and documented, because filters depend on exact values. Also separate availability from publication status. A published product can be out of stock, while an unpublished product should normally be excluded regardless of stock.
Keep stock data current
Synchronize changes from WooCommerce whenever stock is changed by an order, refund, manual edit, scheduled import, or external inventory system. The integration can update the corresponding item in Amazon Personalize through an incremental item update, such as the PutItems API, or through the catalog import process used by the implementation.
A practical synchronization flow is:
- Receive the WooCommerce stock or product update.
- Recalculate the effective purchasability of the product, including variation and backorder rules.
- Update the item record used by Amazon Personalize.
- Update the site cache or search index that supplies fallback recommendations.
- Record the synchronization result and retry failures.
Do not assume that an update is visible everywhere immediately. Amazon Personalize data propagation, application caches, CDN caches, and WooCommerce object caches can have different timings. For high-demand products, the storefront must still validate availability immediately before displaying a recommendation or adding an item to the cart.
Use filters where they fit
Amazon Personalize filters can exclude items based on item metadata or other supported filter conditions. If the item dataset includes an availability value, an implementation can create a filter that excludes records marked as unavailable and pass the filter ARN with the recommendation request.
Conceptually, the filter should express a rule equivalent to:
EXCLUDE ItemID WHERE Items.AVAILABILITY IN ("OUT_OF_STOCK")
The exact filter expression must match the schema field name, data type, and Amazon Personalize filter-expression syntax configured in the account. Test the expression with representative catalog data before deploying it. If backorders are not allowed in a particular placement, exclude both OUT_OF_STOCK and BACKORDER; if they are allowed, use a filter that excludes only the former.
Pass the filter consistently for every recommendation placement that has the availability requirement. A common integration defect is applying the filter to the homepage carousel but not to product-page recommendations, cart cross-sells, or email-generated recommendation jobs.
Always apply a WooCommerce validation layer
A recommendation filter is not a substitute for live validation. Inventory may change after the Amazon Personalize item update, or a cached response may contain an item that became unavailable a few seconds earlier. Before rendering a product card, resolve the product and verify that it is published, visible, purchasable, and valid for the current customer context.
For a PHP-based WooCommerce integration, the final check may look conceptually like this:
$product = wc_get_product( $recommended_id );
if ( ! $product || ! $product->is_visible() || ! $product->is_purchasable() ) {
// Remove the item and request or select a replacement.
}
Use the appropriate WooCommerce APIs rather than reading a cached stock field directly. The validation should also account for product permissions, catalog visibility, variation selection, and any custom rules enforced by the store.
Backfill empty recommendation slots
Filtering can reduce the number of usable results. If a placement needs four cards and the response contains only two eligible products, do not show empty cards or silently reduce the layout without a plan. Request more candidates than the display requires, validate them, remove duplicates, and stop when the desired number of products has been collected.
For example, a four-item carousel might request 12 candidates. The application can then:
- Remove products that fail the WooCommerce availability check.
- Remove products already shown elsewhere on the page.
- Remove products excluded by merchandising or customer rules.
- Use the first four remaining products.
- Fill any remaining positions from a deterministic fallback source.
Good fallback sources include the same category’s best sellers, manually curated products, recently viewed products that remain available, or a WooCommerce query ordered by sales. Keep the fallback logic predictable and instrument it separately from Amazon Personalize recommendations.
Do not train on unavailable products without context
Out-of-stock products can still be useful in historical interaction data. A click or purchase before a product became unavailable remains a valid signal of customer interest. However, the system should not continue presenting that product as an eligible result merely because it has strong historical engagement.
Continue sending valid interaction events, but maintain availability as current item metadata and enforce eligibility at serving time. When measuring recommendation performance, distinguish between a recommendation that was filtered before display and one that was displayed and later became unavailable. This helps the agency identify synchronization problems instead of misclassifying them as model-quality issues.
Measure availability-related outcomes
Add operational and business metrics to the recommendation integration, including:
- The percentage of returned recommendation IDs that fail live product validation.
- The number of filtered candidates per placement.
- The percentage of placements filled by fallback products.
- Clicks and conversions for recommended products that were available at display time.
- Time between a WooCommerce stock change and the corresponding catalog update.
- Requests that return too few eligible products.
Log product IDs, placement names, filter usage, validation results, and fallback reasons without exposing unnecessary customer data. Alerts are especially useful when validation failures or fallback rates increase after a feed, inventory, or caching deployment.
Test the failure paths
Test inventory transitions rather than only testing a static in-stock catalog. A useful test matrix includes a product becoming unavailable before the recommendation request, after the response is cached, and while the shopper is viewing the page. Also test products with multiple variations, backorders, scheduled publication, and different warehouse or customer-location rules.
The expected behavior should be explicit: unavailable products are removed, replacement candidates are selected when possible, and the page remains usable when no eligible recommendation exists. With current item metadata, request-level filtering, live WooCommerce validation, and measured fallbacks, agencies can keep personalized merchandising useful without allowing stale inventory to undermine the storefront.