Skip to content

Commit fab16b2

Browse files
Update components/snipcart/actions/create-discount/create-discount.mjs
Co-authored-by: michelle0927 <[email protected]>
1 parent 385aba4 commit fab16b2

File tree

1 file changed

+9
-21
lines changed

1 file changed

+9
-21
lines changed

components/snipcart/actions/create-discount/create-discount.mjs

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -67,35 +67,23 @@ export default {
6767
hidden: true,
6868
},
6969
},
70-
async additionalProps() {
70+
async additionalProps(existingProps) {
7171
const props = {};
7272
if (this.trigger === "Code") {
73-
props.code = {
74-
type: "string",
75-
label: "Code",
76-
description: "Code for the discount",
77-
};
73+
existingProps.code.hidden = false;
74+
existingProps.code.disabled: false,
7875
}
7976
if (this.trigger === "Total") {
80-
props.totalToReach = {
81-
type: "string",
82-
label: "Total to Reach",
83-
description: "Minimum amount required to activate the discount",
84-
};
77+
existingProps.totalToReach.hidden = false;
78+
existingProps.totalToReach.disabled = false;
8579
}
8680
if (this.type === "FixedAmount") {
87-
props.amount = {
88-
type: "string",
89-
label: "Amount",
90-
description: "Discount amount. Required when discount type is `FixedAmount`",
91-
};
81+
existingProps.amount.hidden = false;
82+
existingProps.amount.disabled = false;
9283
}
9384
if (this.type === "Rate") {
94-
props.rate = {
95-
type: "string",
96-
label: "Rate",
97-
description: "Discount percentage, i.e.: `10`. Required when discount type is `Rate`",
98-
};
85+
existingProps.rate.hidden = false;
86+
existingProps.rate.disabled = false;
9987
}
10088
return props;
10189
},

0 commit comments

Comments
 (0)