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.getSaleIds() 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, shows its start date, and stays out until it goes live. Disabled rules stay out too. If a rule comes back or gets 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.

Customers only see what's meant for them

  • 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 the store still uses the old Sales, you get a notice, because Commerce then ignores catalog pricing rules

What's in it

FeatureWhat it does
Pricing rules fieldFor entries, products, categories and custom elements
EditorsA checkbox list, with each rule's expiry 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 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.0
License
MIT
Compatibility
Craft 5
Supports GraphQL
Last release
September 28, 2026
Activity (30 days)
0
Closed Issues
0
Open Issues
0
Merged PRs
0
Open PRs