site and order system. We have some pretty specific needs for quantity
based pricing that none of the existing volume pricing extensions were a
perfect fit for.
I've been working on my own extension to get exactly what we need and to
help me learn how to work with this platform.
I noticed some choices on order detail views that required additional
Deface overrides that could possibly be avoided with some pretty minor
changes to the core.
The company I work for does mostly bulk orders. The volume discount
price/quantity breakouts are defined several suppliers that we work with.
From supplier to supplier the breakout can vary in terms of what the price
vs quantity values are. One thing each supplier has in common is the
discounts start at unit 1. This is something we need to pass on to the
At a minimum the other volume pricing extensions do the following things:
Decorate Spree::LineItem and redefine the copy_price method
Decorate Spree::Variant to provide a volume_price method
Add a new class that defines the volume discount system which gets
associated with Spree::Variant
I followed this pattern and it got me most of the way. When I was nearly
done implementing the logic our extension needed I realized that I kept
seeing the "list price" of the master variant when I expected to see the
volume price for a particular quantity. This happened because the views
kept using the variant record to get the per-unit price instead of the
actual line item. It usually does this by calling
item.variant.display_amount. In each of these places the same number could
be accessed by calling item.single_money.
The views in question are:
This change would let developers manipulate the per-unit price using
Spree::LineItem without requiring the use of overrides on those views.
Since this is obviously not a bug in spree_core I figured it would make the
most sense to post about it in the group. Being new to Spree I cannot rule
out that these design decisions happend for a reason I am unaware of and
was hoping if anyone knew about such a situation that they chime in.
On a side note I am pretty (sure but not positive)
that https://github.com/spree/spree_volume_pricing is going to have invalid
per unit prices on the checkout summary, order e-mails and in front/back
end order detail pages. It is not overriding any of the views mentioned
above and does not seem to make any changes to the price field of the
Spree::Variant class. Updating the core views to use the price from
Spree::LineItem would solve this problem for that extension. The view
changes do not allow a volume discount on quantities of 1 item, however.
You received this message because you are subscribed to the Google Groups "Spree" group.
To unsubscribe from this group and stop receiving emails from it, send an email to email@example.com.
For more options, visit https://groups.google.com/groups/opt_out.