Low commit activity in last 3 years
Allows multiple types of relationships between products to be defined
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

Spree Related Products (Spree 5.3)

This is a fork of the spree-contrib/spree_related_products gem, updated for compatibility with Spree 5.3.

spree_related_products provides a flexible way to define different types of relationships between your products in a Spree Commerce store. You can configure relationships via the admin panel and manage related products within the Related Products tab of the product edit UI.

Features

  • Define different types of product relationships
  • Manage relationships via the Spree admin panel
  • Supports various use cases like upsells, cross-sells, accessories, and replacements
  • Optionally apply discounts to related products

Use Cases

  • Accessories
  • Cross Sells
  • Up Sells
  • Compatible Products
  • Replacement Products
  • Warranty & Support Products

Relation Types

You can define a RelationType and access related products dynamically:

rt = Spree::RelationType.create(name: 'Accessories', applies_to: 'Spree::Product')
product = Spree::Product.last
product.accessories # => []

To check if a relation type exists for a product:

product.related_products?('accessories') # => true

if product.related_products?('accessories')
  # Display an accessories box..
end

To access all related products:

product.relations # => []

Discounts on Related Products

You can optionally specify a discount that applies when customers purchase both related products.

To enable automatic discounts, create a promotion without a code and add an action of type RelatedProductDiscount.

Installation

  1. Add this gem to your Gemfile:
gem 'spree_related_products', github: 'be-agile/ba_spree_related_products'
  1. Install the gem using Bundler:
bundle install
  1. Copy and run migrations:
bundle exec rails g spree_related_products:install
  1. Restart your server:
rails server

License

This extension is available as open source under the terms of either:

Credits

Originally created by Vinsol. Fork maintained by be agile Co., Ltd..