Get early access

Docs / Platforms / WooCommerce

All docs

Start here

  • Quick startKeys, install, items, events and your first lists, in every library

Platforms

  • ShopifyInstall on Shopify with the default settings, and the three usual problems
  • WooCommerceInstall the WooCommerce plugin, what you see after ten minutes, the usual problems
  • MagentoInstall the Magento 2 module, what you see after ten minutes, the usual problems
  • Any websiteAny other website: one script tag, what recapi reads from your product pages, the usual problems

Reference

  • LibrariesInstall the library for your language, the three calls, and what all eight do for you
  • Public API reference (v1)Every call, field and error of the HTTP API
  • Accessibility statementWhat the row meets for screen readers, keyboards and narrow screens, how it is checked, and what it leaves to your site
  • Limits and errorsEach error code, what caused it and what to do, and the limits behind them

Understand and fix

  • FAQWhat people ask before they sign up: price, platforms, first lists, data, consent, stopping
  • Concepts in plain wordsPlacements, list kinds, visitors, the lift test, variety, Settings, consent and cookie banners in plain words
  • GlossaryEvery word the docs and dashboard use, in two lines each
  • TroubleshootingWhat you see after installing; row missing, empty lists, only popular items, orders or clicks not counted, CORS or key errors: the check and the fix

WooCommerce

Last changed

Installing the recapi plugin for WooCommerce, its updates, what differs on WooCommerce once it runs, and its three usual problems.

In short

  • recapi for WooCommerce is one small plugin file. The quick start (/app/quickstart, WooCommerce) shows it, already set up with your address and public key. It needs WordPress 6.3, WooCommerce 8.3 and PHP 7.4 or later.
  • It counts product views, add-to-carts and purchases, and shows recapi's row on product pages in place of your theme's Related products, under the same heading, and Recently viewed on your home page. Deactivating the plugin brings Related products back.
  • On WooCommerce → recapi, paste a secret key so your server sends your products and paid orders, and answer how your shop asks for cookie consent (until you do, a shop without a consent plugin doesn't learn).
  • Each product's id (the number WooCommerce shows under Products) is its id in recapi.
  • After installing, and for problems that are not WooCommerce's own: troubleshooting.
  • For an accessibility audit: the statement.

What the plugin sends

  • "Often bought together" shows under the row; you can turn it off on WooCommerce → recapi.
  • The front page shows Recently viewed above the footer once the shopper has opened products, with nothing to place; a [recapi] you put there keeps its row, with Recently viewed under it. Turn it off on WooCommerce → recapi ("Show Recently viewed on your home page"), for instance if your theme has its own such section. From plugin 0.29.0.
  • An out-of-stock product's page shows the row right under WooCommerce's notice, titled "Other products in stock", and leaves "Often bought together" out. A [recapi] in the product's description or a block theme's template keeps its place and title. One in Elementor or Divi below the notice, or a box pasted below it, gives way. From plugin 0.19.3.
  • Each purchase carries its order line's paid amount: after discounts, without tax or shipping, in the order's currency. It feeds your test's sales per visitor; the past-orders file carries it too. A later refund or cancellation is not subtracted.

Install

  1. The plugin. Download it from the quick start (your public key is already in it). In your WordPress admin, open Plugins → Add New → Upload Plugin, choose the file and activate recapi. Installed this way or as one file, it takes updates under Plugins.
  2. The secret key. Open WooCommerce → recapi, paste a secret key (rk_sec_…) from the dashboard (Set up → Quickstart, step 1) and save. The plugin then describes your products to recapi (each as you save it, and the whole catalog every day), and sends each order from your server once it is paid.
  3. Cookie consent. On the same page, answer "How does your shop ask for cookie consent?":
    • a banner that feeds the free WP Consent API plugin (Complianz, CookieYes and others): recapi keeps an id once the visitor accepts Statistics cookies;
    • another banner, which runs recapi.setConsent(true) once the visitor accepts statistics cookies, and recapi.setConsent(false) if they withdraw;
    • your shop needs no cookie banner: every visitor gets an id unless their browser asks not to be tracked.
  4. Past orders (optional). Download them from WooCommerce → recapi and upload the file on Your data (/app/import, under Set up) in the dashboard. Recommendations then learn from your last 90 days of sales from day one.

Your visits and test orders are not counted from a browser where you opened the WordPress admin as a shop manager or administrator (what it stores).

The row appears on product pages with no editing. Elsewhere (the cart page, a page built with Elementor or Divi, a theme that shows related products its own way), or in a product's description to move it there, add the shortcode [recapi], or with a title [recapi heading="You may also like"]. A page shows one row, however many you add.

Without the upload form

Copy the plugin from the quick start, save it as recapi.php, upload it to wp-content/plugins/recapi.php and activate it. No access to your files? In a snippets plugin (Code Snippets, WPCode), add a PHP snippet, paste the file without its first line and run it everywhere.

The code that draws the row and counts visits comes from recapi, so each fix of ours there reaches your shop within a day. If the quick start says your shop runs a plugin saved before that, save the new file once in place of the old one.

Updates

Most fixes need no update. When a fix changes the plugin itself (the product sync, paid orders, the settings page), WordPress shows update available for recapi under Plugins, and one click installs it.

  • WordPress's View version details link on that row shows what the update brings.
  • Your keys, consent answer and settings stay as they are.
  • A plugin installed as one file moves into a recapi folder at its first update, still active.
  • The update comes only from recapi's API, the address the plugin was installed for.
  • Automatic updates stay your choice: WordPress's own Enable auto-updates link on the plugin list.
  • A copy in a snippets plugin gets no updates: replace the snippet when the quick start asks you to.

After ten minutes

Besides what every shop sees, WooCommerce adds:

  • The row sits under your theme's "Related products" heading. Until recapi's cards arrive, and whenever recapi can't load or has nothing to show, it holds your own related products, as before the plugin (from plugin 0.30.0). With none to show, the page holds the rows' place with blank cards from the start, so it doesn't jump as they load (from plugin 0.33.0); that space closes after 4 s if recapi can't load.
  • A new shop with few orders may show "Often bought together" with similar products, or not at all. Plugins older than 0.12.0 always show its title, until you install the plugin again.
  • With a secret key, plugins before 0.19.0 may mark a product just bought "You looked at this": update the plugin.
  • WooCommerce → recapi shows when the catalog was last sent and how many products went ("Last sent … UTC: N products"), with the reason if any were refused.
  • Set up → Your data (/app/import) lists your products once the secret key has sent them.

The three usual problems

"WordPress says recapi isn't learning from my visitors"

Cause. You haven't answered the cookie consent question, and the shop has no WP Consent API plugin. The plugin then stores nothing on visitors' devices and sends events without a visitor id, so your recommendations stay on popular products.

Fix. Open WooCommerce → recapi and answer "How does your shop ask for cookie consent?". Then view a product on your shop.

Check. Send your first events warns about events without a visitor id. Once that clears, the notice leaves your plugin list.

"recapi counts add-to-carts but misses orders"

Cause. Without a secret key, purchases are sent only from the order-received page. A buyer who pays off-site and never comes back, or who blocks scripts, is not counted.

Fix. Paste a secret key on WooCommerce → recapi. Your server then sends each order once it is paid, whichever way the buyer goes, and each order counts once. It sends only orders paid from then on; older ones belong in the past-orders file.

Check. As in orders are not counted.

"I don't see recapi's row"

Cause. The plugin replaces Related products where WooCommerce puts them. A theme that removed them, prints them its own way, or a page made in Elementor or Divi has no spot to fill.

Fix. Add [recapi] where you want the row, or a Custom HTML block holding the same box as Shopify's (paste it whole).

Check. As in the row is missing: Request recommendations stays on Waiting: no recommendation served while views arrive.

Settings

All on WooCommerce → recapi, in the quick start's order:

  • Secret key. None by default: the cards then come from your shop's own Store API, and only the order-received page sends purchases. The key stays on your server and is never shown back.
  • Cookie consent. No answer by default, or the WP Consent API answer when that plugin is installed. What recapi gets before a visitor accepts: consent.
  • Your pages. "Often bought together" under the product page's row, and Recently viewed on the home page: both on by default.
  • Past orders. A download of the last 90 days of processing and completed orders, one line per product bought: your product id and the buyer's customer id, or for a guest a code made from their email that recapi can't turn back into it. Uploading it again adds nothing twice.

Caches, look and placements

  • Page caches (WP Rocket, LiteSpeed Cache and others) can keep caching product pages: the plugin prints nothing about the visitor there.
  • To restyle the cards, your theme's CSS can target #recapi-recommendations (a, img, .recapi-price, .recapi-was) and .recapi-heading.
  • A product on sale shows its regular price struck through, as your theme shows it: your shop's own figure. Recapi computes no reduction and keeps no price history. A variable product shows it only when every variation is reduced.
  • Each row has its own placement (product, cart, shortcode, and recently_viewed for the home page's); see concepts.