PHPackages                             ether/purchase-patterns - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ether/purchase-patterns

ActiveCraft-plugin[Utility &amp; Helpers](/categories/utility)

ether/purchase-patterns
=======================

Easily keep track of and show products customers bought together. Plus, sorting by individual and order sales.

1.1.5(6y ago)33.5k1[2 issues](https://github.com/ethercreative/purchase-patterns/issues)proprietaryPHPCI failing

Since Jun 17Pushed 5y ago2 watchersCompare

[ Source](https://github.com/ethercreative/purchase-patterns)[ Packagist](https://packagist.org/packages/ether/purchase-patterns)[ RSS](/packages/ether-purchase-patterns/feed)WikiDiscussions v1 Synced 1w ago

READMEChangelog (6)Dependencies (2)Versions (8)Used By (0)

[![Purchase Patterns](resources/banner.png)](resources/banner.png)

Purchase Patterns
=================

[](#purchase-patterns)

Easily keep track of and show products customers bought together. Plus, sorting by individual and order sales.

Requirements
------------

[](#requirements)

This plugin requires Craft CMS 3.0.0 or later, and Craft Commerce 2.0.0-beta.2 or later.

Installation
------------

[](#installation)

Purchasable via the Plugin Store.

Usage
-----

[](#usage)

Use the `craft.purchasePatterns.related` function in your templates to get related products that customers also bought.

```
ProductQueryExtended related ( Product|Order $target [, int $limit = 8 [, ProductQuery $paddingQuery = null [, array $filter = [] ] ] ] )
```

The function returns a `ProductQueryExtended`, so you can include additional query parameters as needed. The `id` parameter is already set and shouldn't be overridden.

```
{% set customersAlsoBought = craft.purchasePatterns.related(
    product,
    10
).fixedOrder(true).all() %}
```

Setting `fixedOrder` to true will sort the products by times purchased together.

The `paddingQuery` allows you to specify a `ProductQuery` that will be used to pad out the related results if they fall below the given `limit`. This query should NOT include things like `order`, `limit`, or execution commands like `all`.

```
{% set customersAlsoBought = craft.purchasePatterns.related(
    order,
    20,
    craft.products.relatedTo(product.myCategory)
).orderBy('random()').all() %}
```

**Editor's Note:** `random()` is Postgres specific. Use `RAND()` for MySQL.

`filter` expects an array of properties that will be used to filter the final result. You can use this to ensure your query always returns the expected number of results. You can pass any properties that you would otherwise include in the outer query:

```
{% set customersAlsoBought = craft.purchasePatterns.related(
    order,
    20,
    craft.products.relatedTo(product.myCategory),
    { availableForPurchase: 1 }
).all() %}
```

For more info on the filter feature (added by [jmauzyk](https://github.com/jmauzyk)) see [\#3](https://github.com/ethercreative/purchase-patterns/pull/3).

### Extended Product Query

[](#extended-product-query)

The extended product query allows you to sort the products by `qtyCount` and `orderCount`. It extends the base product query, to you can use it the same way as you would `craft.products`. The `related` query above returns an extended query, as does:

```
{% set products = craft.purchasePatterns.extended().orderBy('orderCount DESC').all() %}
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance7

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~45 days

Recently: every ~36 days

Total

7

Last Release

2252d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/30c8191e4ff2ab8c26533caccdb3d82972acfb51bc5dc9650cb1d63b6ec48e82?d=identicon)[ether](/maintainers/ether)

---

Top Contributors

[![Tam](https://avatars.githubusercontent.com/u/977594?v=4)](https://github.com/Tam "Tam (34 commits)")

---

Tags

craft-commercecraft-plugincraft3craftcms

### Embed Badge

![Health badge](/badges/ether-purchase-patterns/health.svg)

```
[![Health](https://phpackages.com/badges/ether-purchase-patterns/health.svg)](https://phpackages.com/packages/ether-purchase-patterns)
```

###  Alternatives

[spicyweb/craft-neo

A Matrix-like field type with block hierarchy

395798.1k10](/packages/spicyweb-craft-neo)[verbb/events

A full-featured plugin for event management and ticketing.

2311.7k](/packages/verbb-events)[verbb/vizy

A flexible visual editor field for Craft.

4348.6k](/packages/verbb-vizy)[verbb/social-poster

Automatically post entries to social media.

918.5k](/packages/verbb-social-poster)[verbb/icon-picker

A slick field to pick icons from. Supports SVGs, Sprites, Webfonts, Font Awesome and more.

16162.4k4](/packages/verbb-icon-picker)[craftcms/shopify

Shopify for Craft CMS

549.2k1](/packages/craftcms-shopify)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
