Take some action for Spree abandoned carts
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
bin
config
db/migrate
lib
spec
.gitignore
.rspec
.travis.yml
Gemfile
LICENSE
README.md
Rakefile
spree_abandoned_carts.gemspec

README.md

Build Status

SpreeAbandonedCarts

Take some action for abandoned (incompleted) carts.

Override Spree::Order#abandoned_cart_actions with your logic. By default an email is sent, see AbandonedCartMailer.

You have to trigger the method in some way, an example recurring Sidekiq worker is included.

Installation

Add spree_abandoned_carts to your Gemfile:

gem 'spree_abandoned_carts', github: 'freego/spree_abandoned_carts', branch: 'X-X-stable'

Bundle your dependencies and run the installation generator:

bundle
bundle exec rails g spree_abandoned_carts:install

Usage

There are some preferences you can change (defaults are shown here):

SpreeAbandonedCarts::Config.tap do |config|
  # when an order can be marked as abandoned
  config.abandoned_after_minutes = 1440 # 24 hours
  # how often the sidekiq worker should run
  config.worker_frequency_minutes = 30
end

You can perform the processing of the abandoned carts at any time:

Spree::AbandonedCartService.perform

or use the auto processing solution (based on Sidekiq):

Spree::AbandonedCartWorker.perform

To modify the email, you just have to override Spree.t(:abandoned_cart_subject) and app/views/spree/abandoned_cart_mailer/abandoned_cart_email.html.erb.

Testing

First bundle your dependencies, then run rake. rake will default to building the dummy app if it does not exist, then it will run specs. The dummy app can be regenerated by using rake test_app.

bundle
bundle exec rake

When testing your applications integration with this extension you may use it's factories. Simply add this require statement to your spec_helper:

require 'spree_abandoned_carts/factories'

Copyright (c) 2015-2017 Alessandro Lepore, released under the New BSD License