Overview
Craft Pricing Rules Relationship is a field that lets you build relationships between Craft Commerce Pricing Rules and elements. It bridges Craft Commerce's built-in pricing rule management with Craft's own element relationships, so store managers can link pricing rules to any element type without any fuss.
Features
- Relate rules to anything - Link Commerce catalog pricing rules to entries, products, categories, or whatever custom element you're using
- Plain checkbox field - Editors tick the rules they want from a straightforward list, no fuss
- Expiry-aware - Expired rules drop out of your templates on their own, so nobody has to untick anything by hand. You can show each rule's expiry date beside it too
- Respects customer groups - A rule scoped to a customer group only returns its products to users in that group, so nothing leaks across groups
- In-stock filtering - Pass
hasStock: trueand out-of-stock products are left off the list - Template-ready -
craft.pricingRulesRelationship.getSaleIds()hands you the matching product IDs, ready for a product query
Perfect For
- Tying pricing rules to specific content
- Linking catalog pricing rules to marketing campaigns
- Keeping your pricing strategies organised across the commerce site