Order Level Pricing Scripts

This page contains a listing of available variables for adjusting pricing at the Order Level.
To see how Pricing Scripts work generally, please read General Rules for Pricing Scripts .

In contrast to scripts for materials and post-processing, Order Level Pricing Scripts are meant to be applied based on the selections of the customer while ordering. That is why these variables are accessible for each material and post-processing method.

As Order Level Pricing Scripts are applied to a whole order, they are not added to a material pricing script. Instead, place them in Settings → Agile ERP Settings → Order Pricing → Additional Order Fees.

 

Available Order Level Variables

Variable

Description

Variable

Description

lines[0].model.volume

Line volume for the first line.
(Use [1] for the 2nd item and so on)

lines[0].support.volume

Line support volume for the first line.
(Use [1] for the 2nd item and so on)

All other model and support variables

See model and support variables here: Material Pricing Scripts based on Material Cost

lines[0].price

Line unit price for the first line.
(Use [1] for the 2nd item and so on)
This value is null if the line is to be priced manually

lines[0].quantity

Line quantity
(Use [1] for the 2nd item and so on)

lines[0].title

Line name
(Use [1] for the 2nd item and so on)

lines[0].product.title

Material name of the line item
(Use [1] for the 2nd item and so on)

lines[0].product.technology

3D printing technology of the line item
(Use [1] for the 2nd item and so on)

lines[0].post_processings[0].title
lines[0].post_processings[0].price
lines[0].post_processings[0].color

Post processing title, price (net) and color for the line item
(Use [1] for the 2nd item and so on)

line[0].product.density_min
line[0].product.density_max

Line density for the material
(Use [1] for the 2nd item and so on)

pick_up

Boolean, if true if shipping type is Pick Up Location

User Based Pricing

See User Based Pricing Scripts

Note: If Manual Pricing is enabled and triggered, the resulting Request will have a total request value of ‘null’. Therefore, if using the lines[0].price variable, it is necessary to allow for this null condition in the pricing script to avoid a script error.

Examples

Shipping Fee based on Weight

Calculates the weight of all models in the basket and charges €10 / kg as an additional shipping fee.

let mass = 0; let rate = 10; let total_volume = 0; let total_quantity = 1; for (let line of lines) { total_quantity = line.quantity; total_volume = (line.model.volume + line.support.volume) * total_quantity mass += total_volume * line.product.density_min / 1000000; } let additional_cost = rate * mass; additional_cost;

Discount based on pickup location selected

let discount; if (pick_up){ discount = 100; } else { discount = 1; } -discount;

Discount based on Material

In this example, a discount is applied if the total volume / area of the total order of all items in a specific material exceeds a threshold.

// Discount Based on total volume / area // Change this to the material const material = "PA12"; // leave the following lines untouched let material_subtotal = 0; let material_volume = 0; let material_area = 0; let discount = 0; for (let line of lines) { if (line.product.title == material) { material_volume += line.model.volume; material_area += line.model.area; material_subtotal += parseFloat(line.price); } } // Adjust the following variables for you needs if (material_volume > 10000 && material_area > 1000) { discount = 0.05 * material_subtotal; } else if (material_volume > 20000 && material_area > 2000) { discount = 0.10 * material_subtotal; } // Last line contains the negative fee = discount. -discount;

Additional Fee for Changing Materials

Checks if there are models with different materials but the same technology. If yes, we will charge $25 for each material switch on a machine.

Minimum Order Fee for Materials & Post-Processing

This script takes care that the printing and/or post-processing will cost at least a certain amount.