Skip to content

Introduction

Research shows about 60% to 80% of the users who go to the checkout page, do not complete their purchase. Even the best optimized checkout process has an abandonment rate of 20%

Cart gets abandoned for many reasons.

But we have good news for you. Install our addon and automatically recover your lost revenue absolutely free.

How Does Abandoned Cart Work?

The add-on captures the email address of users on the checkout page.

If the purchase is not completed within 15 minutes, it starts sending an automated series of follow up emails that you can customize to match your brand.

Through the email series, you can: remind them to complete the purchase, ask for feedback or offer a custom discount that will entice potential buyers to complete the purchase. You can send as many emails as you would like.

Below is just an example of email sequence you can have:

  • 1st email after 1 hour: Ask if there was any technical issue.

  • 2nd email after 24 hours: Remind to complete purchase

  • 3rd email after 72 hours: Offer a unique, limited time 5% discount.

Server Requirements

php
- PHP Verion: 8.0.2+ to latest php version
- MySQL Version: 5.7+
- BCMath PHP Extension
- Ctype PHP Extension
- Fileinfo PHP Extension
- JSON PHP Extension
- Mbstring PHP Extension
- OpenSSL PHP Extension
- PDO PHP Extension
- Tokenizer PHP Extension
- XML PHP Extension
- curl enable
- zip Extension
- gd Extension

Installation

WARNING

Make sure to backup your files and database. Then follow the steps below.

Extract the downloaded zip file to your project root directory.

Now we need write few lines of code to some files. Don't panic its so easy even if you are not a tech guy.

1. Open .env file and add this code

env
AC_ENABLE_TRACKING=true
AC_NOTIFY_ADMIN_ON_RECOVERY=true
AC_SEND_RECOVERY_REPORT=true
AC_CUT_OF_TIME_IN_MINUTES=30
AC_EMAIL_FROM_NAME="${APP_NAME}"
AC_EMAIL_FROM_ADDRESS="recovery@activeecom.test"
AC_EMAIL_REPLY_TO_ADDRESS="recovery@activeecom.test"
AC_RECOVERY_REPORT_TO_EMAIL="admin@activeecom.test"

2. Open app\Providers\RouteServiceProvider.php and add this code

php
/**
 * Define the routes for the application.
 *
 * @return void
 */
public function map()
{
    $this->mapApiRoutes();

    $this->mapApiSellerRoutes();

    $this->mapAdminRoutes();

    Route::middleware('web') 
        ->namespace($this->namespace) 
        ->group(base_path('routes/abandoned_cart.php')); 

    $this->mapSellerRoutes();

    $this->mapAffiliateRoutes();

    // ...
}

3. Open app\Console\Kernel.php and add this code

php
/**
 * Define the application's command schedule.
 *
 * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
 * @return void
 */
protected function schedule(Schedule $schedule)
{
    $schedule->command('abandoned-cart:handle')->everyMinute(); 
    $schedule->command('abandoned-cart:send-mail')->everyMinute(); 
    $schedule->command('abandoned-cart:mark-as-lost')->daily(); 
}

4. Open app\Models\User.php and add this code

php
namespace App\Models;

use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Laravel\Sanctum\HasApiTokens;
use App\Models\Cart;
use App\Notifications\EmailVerificationNotification;
use Spatie\Permission\Traits\HasRoles;
use App\Models\AbandonedCart\AbandonedCart; 
use App\Models\AbandonedCart\Cart as AcCart; 

class User extends Authenticatable implements MustVerifyEmail
{
    // ...
    public function userCoupon(){
        return $this->hasOne(UserCoupon::class);
    }

    public function acCart() 
    { 
        return $this->hasOne(AcCart::class); 
    } 

    public function abandonedCart() 
    { 
        return $this->hasOne(AbandonedCart::class); 
    } 
}

5. Open app/Providers/AuthServiceProvider.php modify this code

php
* @var array
*/
protected $policies = [
  'App\Models\Model' => 'App\Policies\ModelPolicy', 
  // 'App\Models\Model' => 'App\Policies\ModelPolicy',
];

/**

6. Open app/Providers/EventServiceProvider.php and add this code

php
namespace App\Providers;

use Illuminate\Support\Facades\Event;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use App\Models\Cart; 
use App\Models\CombinedOrder; 
use App\Observers\CartObserver; 
use App\Observers\CombinedOrderObserver; 

/**
 * Register any events for your application.
 *
 * @return void
 */
public function boot()
{
  parent::boot();

  //
  Cart::observe(CartObserver::class); 
  CombinedOrder::observe(CombinedOrderObserver::class); 
}

7. Open resources/views/backend/inc/admin_sidenav.blade.php and add this code

admin_sidenav

blade
{{-- Abandoned Cart Menu Include --}}
@include('backend.abandoned_cart.inc.menu')

8. After all these steps now go to the install url

php
http://yourdomain.com/admin/ac/install

Make sure to replace yourdomain.com with your actual domain. This will setup the database and data for the addon and you are ready to go.

9. Add CRON for laravel scheduler

  • Make sure to use php 8.0.2+ version
  • Use >> /dev/null 2>&1 at the end of the command to prevent email notifications.
bash
* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

Example:

cron jobs

Reference: How to set up a cron job for Laravel scheduler in cPanel