concretecms-community-store / community_store

An open, free and community developed eCommerce system for Concrete CMS
https://concretecms-community-store.github.io/community_store/
MIT License
105 stars 66 forks source link

Shipment method based on product groups? #837

Closed mlocati closed 8 months ago

mlocati commented 8 months ago

I have this request from a customer of mine:

  1. if the order total is below X: use shipping method M1 (which costs P1)
  2. if the order total is X or more: use shipping method M2 (which costs P2)

BUT

  1. if the order contains products belonging to certain groups, we should use shipping method M3 (which costs P3) - regardless of the order amount.

Community Store already allows implementing 1. and 2.

But I don't see a way to implement 3. That's correct? If so, I'd submit a pull request that adds these two info to the shipping methods: a. apply this shipping method only for orders that don't contain any product belonging to one or more of the following groups: ... b. apply this shipping method only for orders that contain one or more product belonging to one or more of the following groups: ...

[!NOTE] If you want to know the reason of this request:

  • for orders up to 99.99 €, the shipment costs 7 €
  • for orders from 100 €, the shipment is free
  • orders containing products discounted by 50% or 70%, the shipment costs 7€ for any order amount
Mesuva commented 8 months ago

You are correct in your description.

I've had a similar request in the past, but I explained to the client how it starts to get potentially quite complex when you've got both kinds of product in the same cart. So I think I convince them to handle shipping a different way.

But if you believe you have a neat/generic way to handle this I'd certainly welcome the addition, it only adds to the flexibility.

mlocati commented 8 months ago

Yep, I know it's rather complex. But you know, the customer is always right 😉

What about these new options?

Mesuva commented 8 months ago

That makes sense. I would word them:

"Don't offer this shipping method if any product is in any of the following groups" An example might be a very large item, that can't be shipped with express shipping.

"Only offer this shipping method if any product is in any of the following groups" An example might be a 'pickup' option, that is only offered if someone includes in their order a product that can't be shipped

So for 'orders containing products discounted by 50% or 70%, the shipment costs 7€ for any order amount', you would:

So you'd actually need three shipping options

mlocati commented 8 months ago

What about orders with mixed products (discounted and not discounted)?

Shipment methods using "Don't offer this shipping method if any product is in any of the following groups" wouldn't be offered.

So, we'd need 4 options:

  1. Don't offer this shipping method if any product is in any of the following groups
  2. Don't offer this shipping method if all the products are any of the following groups
  3. Only offer this shipping method if any product is in any of the following groups
  4. Only offer this shipping method if all the products are in any of the following groups

When the store owners edit the shipping method, I'd add two fields:

Label: Applicability based on product groups Field: a <select> element with the 4 options above, plus a default "Don't care" option

Label: Product groups Field: list of product groups (hidden if the <select> above is "Don't care")

Mesuva commented 8 months ago

That would cover everything.

I don't think you need all four options for your client's particular problem, but if you are adding them, it probably makes sense to add the other options anyway.

mlocati commented 8 months ago

A pull request is on its way 😉

mlocati commented 8 months ago

A pull request is on its way 😉

Here it is: #838