reactioncommerce/reaction-admin

Discount minimum order amount condition is forced to 0

karaarda opened this issue · 0 comments

Issue Description

Discount minimum order amount is forced to 0 without a valid reason in DiscountCodeForm.js

Steps to Reproduce

Add a new form field to set minimum order amount, which won't work

Possible Solution

Remove following code segment:

        if (discountCodeInput.conditions) {
          // Set order minimum to 0, this will allow a discount to be
          // Redeemed infinitely on any number of orders.
          _.set(discountCodeInput, "conditions.order.min", 0);
        }

This should be handled by SimpleSchema by adding the following fields to do schema defined in the same file:

  "conditions.order": {
    type: Object,
    defaultValue: {}
  },
  "conditions.order.min": {
    type: Number,
    optional: true,
    defaultValue: 0
  },
  "conditions.order.max": {
    type: Number,
    optional: true
  },