Search by

johnhenry / craft-pricing-rules-relationship

johnhenry

A field that ties Craft Commerce catalog pricing rules to any element, so offer pages list the products those rules cover.

Package info

github.com/john-henry/craft-pricing-rules-relationship

Homepage

Documentation

Type:craft-plugin

pkg:composer/johnhenry/craft-pricing-rules-relationship

Fund package maintenance!

john-henry

Buy Me A Coffee

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

1.1.1 2026-11-27 15:31 UTC

This package is auto-updated.

Last update: 2026-11-27 15:32:26 UTC


README

Stable Version Static Badge

Pricing Rules Relationship for Craft Commerce

Pricing Rules Relationship for Craft Commerce

Pricing Rules Relationship adds a field that links Craft Commerce catalog pricing rules to an entry, or to any other element. Tick the rules that apply and your template gets the products they cover. When a rule starts or ends, the page changes with it, so nobody has to go back and fix it by hand.

Features

  • Any element: put the field on entries, products, categories or your own element types.
  • A checkbox list for editors: they tick the rules that apply. Each rule can show its end date, and one that hasn't started yet shows its start date, so a sale can be set up ahead of time.
  • Rules come and go on their own: expired, switched-off and not-yet-started rules give no products, so nobody has to untick anything. A rule that's switched back on or extended comes back by itself.
  • Customer groups: a rule limited to a customer group only returns its products to customers in that group.
  • Stock: pass true as the second argument to getProductIds() and out-of-stock products are left out.
  • New rule button: editors who can create pricing rules get a button that opens a new rule in Commerce, in a new tab.
  • Twig, element queries and GraphQL: craft.pricingRulesRelationship.getProductIds() gives you the product IDs for a product query, the field works as an element query param, and pricingRuleProducts does the same job for a headless front end.

Documentation

The full documentation is at johnhenry.ie/plugins/pricing-rules-relationship/docs.

Requirements

  • Craft CMS 5.0 or later
  • Craft Commerce 5.0 or later
  • PHP 8.2 or later

Accessibility

How accessible the plugin is, what's been checked and how to report a problem are all in the accessibility statement.

Support

If you need a hand, open an issue on the GitHub Issues page.

License

This plugin is free to use under the MIT License.

John Henry - Craft CMS Plugins