Skip to content

Add helper util do determine whether a price is variable#261

Merged
jnmau merged 2 commits intomainfrom
feat/variable-price-helper
Mar 11, 2026
Merged

Add helper util do determine whether a price is variable#261
jnmau merged 2 commits intomainfrom
feat/variable-price-helper

Conversation

@jnmau
Copy link
Member

@jnmau jnmau commented Mar 10, 2026

Variable Price Determination

A price is determined to be variable if any of the following conditions are met.

Pricing Model Condition Variable?
per_unit variable_price === true Yes
tiered_volume Always Yes
tiered_graduated Always Yes
tiered_flatfee Always Yes
dynamic_tariff Always Yes
external_getag get_ag.type === 'work_price' Yes
external_getag get_ag.type === 'base_price' AND get_ag.markup_pricing_model === 'tiered_flatfee' Yes
Composite price Never (only components can be variable) No

Why

The variable_price boolean on Price entities is unreliable — it can be true when a price isn't actually variable, or false when it is.

isVariablePrice replaces these checks with deterministic logic based on pricing_model and related fields. This ensures price mappings are only applied when the price truly requires variable input.

@jnmau jnmau review requested due to automatic review settings March 10, 2026 16:33
Copy link
Member

@alexmarqs alexmarqs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! tks!

@jnmau jnmau merged commit ecb2008 into main Mar 11, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants