Pricing Rules Relationship icon

Pricing Rules Relationship

Plugin screenshot thumbnail 1/4
Plugin screenshot thumbnail 2/4
Plugin screenshot thumbnail 3/4
Plugin screenshot thumbnail 4/4

Pricing Rules Relationship

"Can we have a Special Offers page?"

A client asks for a Special Offers page, or a page for the autumn sale. The catalog pricing rules are already set up in Commerce, but there's no way to point a page at them. Commerce has the rules and Craft has relationships between elements, and the two don't meet. So someone ends up picking the products by hand, and the page is out of date the day the sale ends.

Pricing Rules Relationship adds a field that joins them. Put it on an entry, product, category or any other element and editors get a checkbox list of your store's pricing rules. They tick the ones that apply. In your template, craft.pricingRulesRelationship.getProductIds() gives you the IDs of every product those rules cover, ready for a product query.

Offer pages that fill themselves

Pages that keep themselves right

Expired rules drop out of your templates on their own, so nobody has to untick anything. A rule that hasn't started yet can be ticked ahead of time. It shows its start date in the field and gives no products until it goes live. Switched-off rules give none either. If a rule is switched back on or extended, the entry still has it ticked. Craft's caches for a page built this way expire when one of its rules starts or ends, so an offer doesn't outlive its dates.

Who sees what

  • A rule limited to a customer group only returns its products to customers in that group
  • Only live products from the current store come back, and the in-stock filter checks that store's stock
  • Editors without Commerce's Manage promotions permission are only offered rules open to every customer, since a rule's name can say more than you'd want. If every rule is limited to particular customers, the field tells them so rather than saying there are none

If the store still uses legacy Sales, the field tells editors, because Commerce ignores catalog pricing rules while those are in place.

What's in it

FeatureWhat it does
Pricing rules fieldFor entries, products, categories and custom elements
EditorsA checkbox list, with each rule's end date beside it if you want it
TwigOne call for the matching product IDs, with an optional in-stock filter
Element queriesThe field as a query param, so you can find the entries that use a rule
GraphQLThe field, plus pricingRuleProducts and pricingRuleProductCount so a headless front end can build the same offer pages
New rule buttonOpens a new pricing rule in Commerce, in a new tab
Empty stateYour own text for when there are no rules to offer

It's free. It needs Craft CMS 5, Craft Commerce 5 and PHP 8.2 or later.

Accessibility

What's been checked, and anything that still needs work, is in the accessibility statement.

Installation Instructions

To install this plugin, copy the command above to your terminal.

Reviews

This plugin doesn't have any reviews.

Active Installs
2
Version
1.1.1
License
MIT
Compatibility
Craft 5
Supports GraphQL
Last release
November 27, 2026
Activity (30 days)
0
Closed Issues
0
Open Issues
0
Merged PRs
0
Open PRs