Skip to content

cloudsailor/spree-spl

Repository files navigation

Spree SPL (SpartaLoyalty)

Spree-spl is a plugin that provides a promotion switcher for Spree, enabling enhanced loyalty program functionality.

Installation

Add spree-spl to your Gemfile and run bundle install:

gem 'spree-spl'



After installation, add the following line to Spree::Adjustable::AdjustmentsUpdaterDecorator#persist_totals:

apply_spl_adjustments(attributes, totals)

Add the following lines to Spree::OrderUpdaterDecorator#update_adjustment_total:

skip_recalculation = check_spl_adjustments
return if skip_recalculation

Additionally, Add the following lines to view spree/checkout/_line_item.html.erb

<% if spl_adjustment(line_item) %>
  <div class="flex justify-between">
  <span class="text-red-500">
    <%= spl_adjustment(line_item)&.label %>
  </span>
    <span class="text-red-500">
      <%= "#{spl_adjustment(line_item)&.amount} zł" %>
    </span>
  </div>
<% end %>

Add these methods to any other endpoints involved in processing an order in your repository.

Testing

To run tests type in terminal:

bundle update
bundle exec rake test_app
bundle exec rspec

About

No description, website, or topics provided.

Resources

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 6