How to use it
- Select the element and open its Conditions.
- Add one of the four conditions from the Kiln group (see below).
- Choose the comparison and type the value. Dynamic data is allowed in every value.
Customer has purchased
Choose any of, all of or none of, then list what to look for, separated by commas or spaces:
- product IDs, such as
12, 34; - product categories as
cat:and the slug or ID, such ascat:mugsorcat:16. A category counts its child categories too: a mug from "Ceramics > Mugs" counts forcat:ceramics; days:30to count only orders paid in the last 30 days.
For example, cat:mugs, days:90 with any of shows the element to customers who bought a mug in the last three
months. 12, 34 with all of needs both products. An empty list asks whether the customer has any paid order,
or any in the window when you add days:.
Anything else in the list, such as a misspelt category:mugs or a category that doesn't exist, counts as an item
nobody has bought. So a typo hides the element instead of showing it to every customer.
Cart contains
The same list against the visitor's cart. Kiln ignores a days: item here. An empty list with any of is true when
the cart has anything in it. Use it for "add a mug to get free shipping" notes, or to hide an offer for a product
already in the cart.
Customer's paid orders
A number of paid orders, compared with ==, !=, >=, <=, > or <. For example, < 1 for a first-order
welcome, >= 5 for regulars.
Customer's total spent
The customer's total spent on paid orders, as WooCommerce counts it, compared the same way. A partial refund
doesn't lower it. For example, >= 500 for a loyalty tier.
Where it appears in Bricks
Element conditions, in the Kiln group: Customer has purchased, Cart contains, Customer's paid orders and Customer's total spent.
Compared with Product purchased by user
The Bricks condition "Product purchased by user" checks one product: the page's, or the current item in a product loop. It also counts guest orders placed with the customer's email. These conditions check a list of products and categories you choose, against the customer's account only.
How Kiln counts purchases
- Only paid orders count: the statuses WooCommerce treats as paid (Processing and Completed by default). The same goes for the order count and total spent.
- WooCommerce sets a cash-on-delivery order to Processing before any money changes hands, so it counts as paid. If you gate paid content, such as a course, and offer cash on delivery for it, the content shows as soon as the order is placed.
- Only orders on the customer's own account count. Kiln does not match orders by email address. WooCommerce lets a customer change the account email without proving they own the new address, so an email match would give a guest buyer's purchases to anyone who types that address.
- A guest order placed before the account existed counts after you link it to the account (Users > the customer > "Link previous orders").
- Buying a variation counts as buying its parent product. You can also list a variation's own ID.
days:counts from the date the order was paid. An order placed 40 days ago and paid 10 days ago is insidedays:30.
How it works with page caches
Customer has purchased, Customer's paid orders and Customer's total spent don't mark the page uncacheable. A logged-out visitor has bought nothing, so a cache that serves logged-out visitors stays correct.
Cart contains marks the page uncacheable, because every visitor's cart is different, logged out too. Page
cache plugins honor that. A server cache (nginx, Varnish, a CDN that caches whole pages) has to skip visitors with
a cart itself, usually by the woocommerce_items_in_cart cookie, which most WooCommerce hosting already does.
Limits
- A visitor who is logged out has purchased nothing, has 0 paid orders and has spent 0. any of is false for them and none of is true.
- The list takes product IDs and category slugs or IDs. Product names and SKUs do not work. A category slug that doesn't exist matches nothing.
- A list holds up to 50 items, with up to 20 categories. Items past that count as not bought.
- Kiln works out Cart contains when the page loads. A product added to the cart without a page reload (an AJAX add to cart button) shows on the next page view.
- With categories,
days:or all of, Kiln reads the customer's paid orders, once per page view for each window. For customers with hundreds of orders, prefer product IDs with any of or none of and nodays:: that uses WooCommerce's own cached check. - A value for paid orders or total spent that isn't a number never matches.
- WooCommerce Subscriptions is not covered.
- If WooCommerce is switched off or older than 11.1, all four conditions are false, so their elements stay hidden instead of showing to everyone.
Settings
None. Turn the module on in Bricks > Kiln. It is on by default and loads only while WooCommerce is active.
Requirements
Bricks 2.4 or newer, and WooCommerce 11.1 or newer.