-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add coupon code condition rule and element query param
- Loading branch information
1 parent
e98efbb
commit 9f0e2be
Showing
5 changed files
with
132 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
# Release Notes for Craft Commerce (WIP) | ||
|
||
## Administration | ||
### Administration | ||
- Added a new "Coupon Code" order condition rule. ([#3776](https://github.com/craftcms/commerce/discussions/3776)) | ||
- Added a new "Payment Gateway" order condition rule. ([#3722](https://github.com/craftcms/commerce/discussions/3722)) | ||
|
||
- Added a new "Payment Gateway" order condition rule. ([#3722](https://github.com/craftcms/commerce/discussions/3722)) | ||
### Development | ||
- Added the `couponCode` order query param. | ||
|
||
### Extensibility | ||
- Added `craft\commerce\elements\conditions\orders\CouponCodeConditionRule`. | ||
- Added `craft\commerce\elements\db\OrderQuery::$couponCode`. | ||
- Added `craft\commerce\elements\db\OrderQuery::couponCode()`. |
29 changes: 29 additions & 0 deletions
29
src/elements/conditions/orders/CouponCodeConditionRule.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
/** | ||
* @link https://craftcms.com/ | ||
* @copyright Copyright (c) Pixel & Tonic, Inc. | ||
* @license https://craftcms.github.io/license/ | ||
*/ | ||
|
||
namespace craft\commerce\elements\conditions\orders; | ||
|
||
use Craft; | ||
|
||
/** | ||
* Order Coupon Code condition rule. | ||
* | ||
* @author Pixel & Tonic, Inc. <support@pixelandtonic.com> | ||
* @since 5.3.0 | ||
*/ | ||
class CouponCodeConditionRule extends OrderTextValuesAttributeConditionRule | ||
{ | ||
public string $orderAttribute = 'couponCode'; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getLabel(): string | ||
{ | ||
return Craft::t('commerce', 'Coupon Code'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters