Skip to content

Commit 2b546d3

Browse files
committed
[FIX] Remove option attribute from body request if not set
1 parent fb86994 commit 2b546d3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/cartTransaction.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,17 @@ export class CartTransaction {
4141

4242
/* Convert to a JSON object suitable to send to the ERP */
4343
toErpTransaction(): any {
44-
return {
44+
let data: any = {
4545
uuid: this.uuid,
4646
product_id: this.productId,
4747
qty: this.qty,
48-
options: this.options,
4948
};
49+
if (this.options === null || Object.keys(this.options).length > 0) {
50+
data = {
51+
...data,
52+
options: this.options,
53+
};
54+
}
55+
return data;
5056
}
5157
}

0 commit comments

Comments
 (0)