Skip to content

Commit

Permalink
when cart have coupon code and don't support upselling
Browse files Browse the repository at this point in the history
  • Loading branch information
xxl4 committed Oct 15, 2024
1 parent d7200a9 commit 7634b6b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Upselling.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,13 @@ public function applyUpselling($cart) {
'status' => 'processing',
'created_at' => ['>=', now()->subDay()]
]);
//order findwhere created_at >= now()->subDay()
if($processingOrder && !empty($cart->customer_email)) {
//Log::info('Processing order found '.json_encode($processingOrder));

// check the cart have coupon code
if($cart->coupon_code) {
$this->coupon_code = $cart->coupon_code;
}

if($processingOrder && !empty($cart->customer_email) && empty($cart->coupon_code)) {

Cart::saveShippingMethod('free_free');

Expand All @@ -82,13 +86,10 @@ public function applyUpselling($cart) {
Cart::setCouponCode($coupon_code)->collectTotals();
}


Cart::collectTotals();
Log::info('Processing order cart found '.json_encode($cart));
}



}

/**
Expand Down

0 comments on commit 7634b6b

Please sign in to comment.