Skip to content

Commit

Permalink
[FIX] Remove option attribute from body request if not set
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultrey committed Feb 5, 2024
1 parent 76d02bf commit 0d7f10f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/cartTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,17 @@ export class CartTransaction {

/* Convert to a JSON object suitable to send to the ERP */
toErpTransaction(): any {
return {
let data: any = {
uuid: this.uuid,
product_id: this.productId,
qty: this.qty,
options: this.options,
};
if (this.options === null || Object.keys(this.options).length > 0) {
data = {
...data,
options: this.options,
};
}
return data;
}
}

0 comments on commit 0d7f10f

Please sign in to comment.