Skip to content
This repository has been archived by the owner on Aug 8, 2020. It is now read-only.

Latest commit

 

History

History
38 lines (26 loc) · 715 Bytes

calculators.md

File metadata and controls

38 lines (26 loc) · 715 Bytes

Calculators

FixedCalculator

Returns a fixed amount, regardless of the order.

Example:

JekyllStoreEngine.Calculators.Fixed({ amount: 3.50 });

PercentCalculator

Returns a percentage of one of the order's totals.

Example:

JekyllStoreEngine.Calculators.Percent({ field: 'price', percent: 25 });

TieredCalculator

Returns an amount dependent on which tier one of the order's totals falls into.

Example:

JekyllStoreEngine.Calculators.Tiered({
  field: 'volume',
  tiers: [
  	[0, 3.29],   // 0 < volume <= 0.5, it returns 3.29
  	[0.5, 4.59], // 0.5 < volume <= 1.2, it returns 4.59
  	[1.2]        // volume > 1.2, it returns undefined
  ]
});