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.
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:installThere 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
endYou can perform the processing of the abandoned carts at any time:
Spree::AbandonedCartService.performor use the auto processing solution (based on Sidekiq):
Spree::AbandonedCartWorker.performTo 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.
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 rakeWhen 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