Skip to content

Commit

Permalink
fix create rules
Browse files Browse the repository at this point in the history
  • Loading branch information
xxl4 committed Dec 17, 2024
1 parent 3bdef80 commit c635ce2
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ public function createProductQuantityRule($product_id, Request $request){
$request->set('channels', ['all']);
$request->set('customer_groups', ['all']);
$request->set('coupon_type', 0);


// create a new cart rule for the product quantity
$request->validate([
Expand All @@ -324,6 +324,17 @@ public function createProductQuantityRule($product_id, Request $request){
'discount_amount' => 'required|numeric',
]);

Event::dispatch('promotions.cart_rule.create.before');

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

Event::dispatch('promotions.cart_rule.create.after', $cartRule);

return response([
'data' => new CartRuleResource($cartRule),
'message' => trans('Apis::app.admin.marketing.promotions.cart-rules.create-success'),
]);

}

}

0 comments on commit c635ce2

Please sign in to comment.