Learn how to create a cost function for dynamic expenses influenced by attributes or pricing procedures. This guide explains the steps and highlights distinctions between the base and recommended cost functions.
How can I override the cost using a cost function?
For dynamic costs, utilize a custom "cost function" to override it. Define the function under "global custom function" or "pricing group custom functions."
There are two types of costs you can change:
- Cost
- Calc_cost
You can change both by using the set_cost function.
The type is according to the type of the cost function you choose.
If you choose to use it as "Base cost" it will change your cost.
If you choose to use it as "recommended cost" It will change your "calc_cost". This type of cost should be used when the cost is based on the recommended price.
Pricing group settings:
So what is the difference between the two types of cost?
Cost
The pricing engine sets it at the beginning of the pricing process and will override the cost value that currently takes place.
If there isn't any recommended cost function in place, the cost effects will be the ones to be considered from start to finish.
Cost is the one you see in the products page information.
Calc_cost
By default, the pricing engine performs calculations at three distinct stages. First, it calculates the price immediately after generating a recommendation but before applying any rules. Second, it recalculates the price after the recommendation has been set by the rules, but before checking any limits or performing rounding. Third, it makes another calculation after both rounding and limits have been applied.
However, if a custom function is involved, an additional fourth calculation will be performed. In this case, the engine executes a final recalculation after running the custom function.
This cost is not being saved into the base cost value, and in case you want to see it, you should set an attribute to see it and save the value in it in the function.
❗️We do not advise using margin or cost limits when using calc_cost.❗️
- If the initial price recommendation doesn't align with the pre-defined limits or requires rounding, the system first adjusts the price to comply with these limits and rounding rules. Once these adjustments are made, the final price recommendation is generated. The
calc_costwill then be determined based on this adjusted recommended price. - If you've set the limits to be evaluated based on the margin or cost, this evaluation will occur during the second phase. Specifically, it happens after applying any rules, but before enforcing the limits.
- Once the limits are enforced, any previous recommendations may be overridden to comply with these limits.
- If the engine modifies the original price recommendation, the
calc_costparameter becomes obsolete, especially if it was initially based on cost and margin. - If the limits for your price recommendation are specifically based on either cost or margins, and the engine subsequently changes
calc_cost, a new price recommendation might be required. However, to circumvent an endless loop of adjustments betweencalc_costand the price recommendation, the system will not recalculate these limits and margins. Consequently, you may receive a final recommendation that falls below your set limits.
📝 Design consideration:
If you use a cost function as a "global custom function" and another as a "pricing group custom function," Quicklizard's engine will prioritize the one set on the pricing group.
Comments
0 comments
Please sign in to leave a comment.