I've seen this question asked before but it is from some time ago so I wondered if there is any change.

Original question at Trade prices in exp:resso Store

I need to be able to specify alternate pricing based on member group on a per-product basis. The difference between Standard and Trade prices is not universal so each product needs to have 2 price points rather than a blanket discount.

I'm fairly certain that this still isn't "baked in" to Store but does anyone have suggestions about the best way to approach it?

I'm considering using the modifiers but that seems a rather clunky way to do it and I can't see how to apply mods via member group (although I'm new to Store and working my way through the docs).

  • How complex are your products? Will they be using modifiers (e.g. colour, size) or are they just basic Widget X, Widget Y? – Peter Lewis Sep 17 '15 at 19:59

I think the best way to approach this is currently to slightly rethink your IA.

You could have a channel called 'Product' that held the product information, galleries, specifications and reviews.

You could then also have a second channel called 'Product Cost' which would include the Expresso Store field type. You could have a relationship from the 'Product Cost' back to the 'Product' and you could also have a field to select which member group this cost is for.

Then on the frontend when loading the product page you can chose the right 'Product Cost' to show based on the member group.

  • That's quite an interesting approach. I'll need to think it through and consider how it might impact other areas of the site. I'm starting to think that in the long run it might just be easier to use a different add-on. – foamcow Sep 17 '15 at 15:09
  • Wouldn't that then mean you have multiple "product cost" entries associated with each "product", so fragments editing of a product on the backend...? I get enough complaints from clients regarding discounts/sale price being in a separate place to the product entries... – Peter Lewis Sep 17 '15 at 19:56
  • Yes, on consideration this wouldn't fly. The client wouldn't like this approach and I can see it becoming a bit of a pain to use. Interesting idea though. – foamcow Sep 18 '15 at 8:17

As mentioned in the linked post this is not built in. You have a few options you could create an extension if you are comfortable with PHP. This would be hands down the best approach and most easy to maintain for your clients down the road as they would simply be able to enter the prices per member group as they would normally enter prices in Store.

Another option as others have mentioned would be to have 2 channels with a product description and another channel with product prices per member group.

Yet another option is using modifier names and conditionals in your template.

The last option would be to enable User Defined Prices in the particular channel. Then you could build out Matrix/Grid fields for each of your modifiers with both normal and trade prices(if they modifiers need both pricing. Then in your template you would need to use the input custom modifiers to allow users to select the modifiers. Then you would need to write some javascript to calculate the totals based upon the modifiers and the member group and pass that to a hidden price field. I am doing something very similar on a project with great success.

  • I did wonder about trying user defined prices but doesn't this then open the site up to abuse whereby users could modify prices on the form? The thought needing to write additional code to check that prices are as they should be isn't something I relish. – foamcow Sep 18 '15 at 8:19
  • User defined prices do open up some vulnerability for abuse from nefarious technical users and I would caution you if you were selling digital products not to use user defined prices. If you are selling physical products the site admin would be able to catch abuse issues while an order is being processed. – Justin Long Sep 18 '15 at 9:42

I have managed to do what I need using product modifiers and some conditional template logic based on the logged in member group.

The logic checks the member group and if the visitor is a "Trade" member then it includes a hidden form field containing the option data within the products tag.

Within the {exp:store:product} tag pair...

{!-- add a price modifier for trade pricing --}
{if member_group=='6'}
            <input type="hidden" name="{modifier_input_name}" value="{option_id}">

I then display the price using:

{if member_group=='6'}
            {if option_name=="Trade" || option_name=="trade"}
                <h2 class="product__price">Trade Price: &pound;{exp:math formula="{price_inc_mod_val} * 1.2" decimals="2" round="up" trailing_zeros="yes"}</h2>
                <h3 class="product__price--ex-tax">Ex Tax: &pound;{price_inc_mod_val}</h3>
    <h2 class="product__price">Price: &pound;{exp:math formula="{sundries-details:price_val} * 1.2" decimals="2" round="up" trailing_zeros="yes"}</h2>
    <h3 class="product__price--ex-tax">Ex Tax: &pound;{price_val}</h3>

The math plugin is so I can enter prices without tax in the backend but display them with taxes on the front end.

This appears to be working OK but I haven't fully tested it yet. My concern is that it requires the client to set a specifically named option. It's also a bit crappy on the UI front for the client entering prices. But I think I can get away with it.

If I can find a way to preset a product option then I'd be a lot happier.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.