From 1608f2de5055880283f73de1b25bec71eadcf90b Mon Sep 17 00:00:00 2001 From: Steve <34465153+xxl4@users.noreply.github.com> Date: Wed, 14 Aug 2024 11:26:21 +0800 Subject: [PATCH] fix upselling code --- src/Upselling.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Upselling.php b/src/Upselling.php index 72069b1..43979b4 100644 --- a/src/Upselling.php +++ b/src/Upselling.php @@ -103,23 +103,25 @@ public function applyUpselling($cart) { ]); //order findwhere created_at >= now()->subDay() - - Log::info('Processing order found '.json_encode($processingOrder)); - Log::info("Processing Data:". now()->subDay()); + Log::error('Processing order email '.$cart->customer_email); + Log::error('Processing order cart '.json_encode($cart)); + Log::error('Processing order found '.json_encode($processingOrder)); + Log::error("Processing Data:". now()->subDay()); - if(!$processingOrder) { + if($processingOrder) { //Log::info('Processing order found '.json_encode($processingOrder)); Cart::saveShippingMethod('free_free'); // Apply coupon code - Cart::setCouponCode('hao123'); + $coupon_code = "upselling50"; + Cart::setCouponCode($coupon_code)->collectTotals(); - Cart::collectTotals(); + // Cart::collectTotals(); Log::info('Processing order cart found '.json_encode($cart)); }