web_previously_purchased Shortcode

Display eligible products from the current customer's recent paid WooCommerce orders. The shortcode and Previously Purchased block share their renderer and existing cart behavior.

Usage

[web_previously_purchased title="Order again" limit="10" guest_message="Sign in to see your products." empty_message="No recent products." button_label="Add selected" el_id="order-again" el_class="mb-1"]

Attributes

Attribute Default Accepted values Purpose
title Previously ordered products Plain text; empty hides it List heading.
limit 10 1–50 Maximum distinct eligible products.
guest_message Empty Plain text Guest message; empty hides the block for guests.
empty_message Empty Plain text Empty-result message; the shortcode hides empty history unless this message is supplied.
button_label Add selected to the order Plain text Batch action label; empty leaves individual actions only.
device_visibility Empty Comma-separated web-hide-on-lg, web-hide-on-md, web-hide-on-sm, web-hide-on-xs Device ranges on which to hide the instance.
el_id Empty Unique HTML ID Optional anchor.
el_class Empty Space-separated CSS classes Existing theme helpers.

Behavior and limits

WooCommerce is required for the purchase list. Only the signed-in visitor's account is queried, using WooCommerce's supported order APIs for either HPOS or post-backed orders. There is no customer-ID or email override.

The search covers the most recent 100 paid orders, at most 1,000 order lines and up to the chosen product limit. Fully refunded lines and currently unavailable, restricted or unpublished products are excluded. Simple products support quantities and batch additions; products with options link to their current product page.

Shared caches must exclude authenticated requests. Existing theme/WooCommerce scripts load through the common asset discovery and render fallback. No additional public block stylesheet is created. Custom child-theme row templates remain supported through content-previously_purchased.php.

See Previously Purchased authoring and verification for preview states, cart confirmation and troubleshooting.