-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom price calculation step #237
Comments
I thought about this and in your case, would it not make more sense to have the "stringing service" as a separate product which can be added to the order? I think this is the way many businesses track such add-on items, gift-wrapping too. So there could be 2 ways to implement this:
Would this approach work in your case? |
Hi @michaelbromley, thanks for your ideas!
|
The solution you describe in 2 sounds workable. I think there probably will end up being a custom calculator step, but as it has some rather complex implications, it may not be an immediate prospect. I will leave this issue open and perhaps others may add their use-cases which can inform the design of such a feature. |
I would also be interested in a hook for the price calculation since I would like to implement two discount systems:
The data structures are easy to implement using the existing plugin architecture but as discounts affect the price a feature like this would be necessary. I'm new to vendure and don't have much experience with the architecture yet but it seems a method similar to the lifecycle methods described in https://www.vendure.io/docs/typescript-api/plugin/plugin-lifecycle-methods/. I might also be able to contribute to such a feature if needed but as I said I'm not familiar with the whole architecture yet and maybe some things mentioned by me don't fit it. |
Hi @Tyratox
|
Wow that was a quick response! No I didn't come across the Promotions system yet but it sounds very promising. Now I'll definitely take a closer look at it, thank you! |
Yes you were right the promotions system seems to work for these requirements, thank you!
hasFacetValues method.
That way promotion actions could handle more complex discounts as otherwise one has to create additional promotion rules for all individual products. (i.e. one action instead of multiple copies of condition: order contains >= of product id x => action reduce price of order depending on quantity of the same product) |
@Tyratox I agree, I actually think all of the configurable classes should be able to inject dependencies. I recently came up with a pattern to do that which I implemented in the new JobQueueStrategy interface. It has an I'll create an issue to track this tomorrow. |
@michaelbromley That would be even better of course. Impressing work! |
@michaelbromley What would the approach to handle a shop with a product configurator? e.g. for configurable furnitures (means the furniture is specially made for the customer) . In this case the customer would select e.g. a product like a table. Based on this selection you have to select different parameters (variabel input width, height, depth etc - selection like decor, material property) -> The price should be (of course) dynamicaly calculated... Is this use case feasible? |
@maku I guess in this case, having a matrix of possible ProductVariants does not make sense. This would indeed be the archetypal use-case for a custom price calculation step. I'm going to add this to the next minor release milestone and have a go at an implementation. The basic idea would be to allow you to define a |
@michaelbromley Great, thank you. In general, appart from the price calculation, what would be the approach to bring such a system into the vendure architecture. Is this a plugin? |
@maku yes, plugins are where all your custom functionality should reside. In this case, the plugin would define whatever custom fields required to store your configurator params, as well as (eventually) your custom PriceCalculationStrategy. |
This is now available in v0.12.3 - see https://www.vendure.io/docs/typescript-api/orders/order-options/#pricecalculationstrategy |
Is your feature request related to a problem? Please describe.
I need to change the price according to whether a custom field is set to true or false.
Describe the solution you'd like
A custom price calculation step where you can increase the product / order line price depending on a custom field or custom requirement.
Describe alternatives you've considered
None
Additional context
I want to sell rackets amongst other things. Usually the pro rackets come without a string and I want to offer a stringing service with the product. I can add the required informations into custom fields of the OrderLine, but I don't see a possibility to increase the price. Another use case would be when you offer gift wrapping for the product and want to increase the price.
The text was updated successfully, but these errors were encountered: