Skip to content

Commit

Permalink
fix rules
Browse files Browse the repository at this point in the history
  • Loading branch information
xxl4 committed Dec 17, 2024
1 parent 7fa9dcd commit 7f6ffcc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -685,9 +685,13 @@ public function getConditionAttributes()
* description="Rules",
* example={{
* "value": "2",
* "operator": ">=",
* "attribute": "cart_item|quantity",
* "operator": "==",
* "attribute": {
* "cart_item|item_qty",
* "product|attribute_family_id"
},
* "attribute_type": "integer",
* "action_type": "by_percent",
* "price": "10.50"
* }},
* ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,9 @@ public function createProductQuantityRule($product_id, Request $request){
], 404);
}

$product_family_id = $product->attribute_family_id;



// create a new cart rule for the product quantity
$request->validate([
Expand All @@ -325,6 +328,7 @@ public function createProductQuantityRule($product_id, Request $request){
'discount_amount' => 0,
];

// need match product quantity and product family id for this rule and create it.
Event::dispatch('promotions.cart_rule.create.before');

$cartRule = $this->getRepositoryInstance()->create($request->all());
Expand Down

0 comments on commit 7f6ffcc

Please sign in to comment.