Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In order to offer competitive pricing, especially for larger orders or particular customer groups, the if/else functionality can adjust the price based on specific conditions. Additional support variables are available under User-based Pricing and Conditional Variables.

Code Block
languagejs
let price = model.volume * 0.0002;  // model.volume in cubic mm

// Add a 10% Discount when ordering more then 10 items
if(item.quantity > 10) {
    price = price * 0.90;
}

// Provide a 5% Discount for Users with a @3yourmind Address
else if(user.email && user.email.endsWith('@3yourmind.com')) {
    price = price * 0.95;
}

// 90$ Discount if price is above 1500
else if(price > 1500) {
    price = price - 90;
}

price; // last line contains final price