Hello, can anyone please help.
How do I update the fullorder param in the FE when I call create order?
Is this the correct way of implementing it?
Thank you in advance
import wixStoresBackend from 'wix-stores-backend';
export function createOrder() {
return wixStoresBackend.createOrder(updateFullOrder());
}
export function updateFullOrder(data){
const fullOrder = {
"buyerLanguage": "en",
"currency": "USD",
"weightUnit": "KG",
"billingInfo": {
"address": {
"formatted": "235 W 23rd St New York, NY 10011, USA",
"city": "New York",
"country": "US",
"addressLine": "235 W 23rd St",
"postalCode": "10011",
"subdivision": "NY"
},
"lastName": "Doe",
"firstName": "John",
"email": "john.doe@somedomain.com",
"phone": "+15555555555",
"company": "My company name",
"paymentMethod": "VISA",
"paymentGatewayTransactionId": "29A06193U6234935D",
"paymentProviderTransactionId": "7c03ca74-eaf5-4541-8678-9b857634fdcb"
},
"totals": {
"subtotal": "5",
"total": "5",
"shipping": "0"
},
"channelInfo": {
"type": "WEB"
},
"paymentStatus": "PAID",
"shippingInfo": {
"deliverByDate": "2019-06-23T13:58:47.871Z",
"deliveryOption": "Free Shipping",
"estimatedDeliveryTime": "4:30pm",
"shipmentDetails": {
"address": {
"formatted": "235 W 23rd St, New York, NY 10011, USA",
"city": "New York",
"country": "US",
"addressLine": "235 W 23rd St",
"postalCode": "10011",
"subdivision": "NY"
},
"lastName": "Doe",
"firstName": "John",
"email": "john.doe@somedomain.com",
"phone": "5555555555",
"company": "company name",
"shipmentPriceData": {
"price": "5",
"taxIncludedInPrice": false
}
}
},
"lineItems": [{
"customTextFields": [{
"title": "Notes for delivery",
"value": "Please leave at front door"
}],
"productId": "3fb6a3c8-988b-8755-04bd-5c59ae0b18ea",
"lineItemType": "PHYSICAL",
"mediaItem": {
"altText": "This is a description of the image",
"src": "wix:image://v1/689fa9...ccdc8a.jpg/file.jpg#originWidth=5760&originHeight=3840"
},
"name": "my product's name",
"options": [{
"option": "Size",
"selection": "Medium"
}],
"quantity": 1,
"sku": "36523641234523",
"weight": "1.42",
"translatedName": "Nombre traducido",
"discount": "0",
"tax": "5",
"priceData": {
"price": data.price,
"taxIncludedInPrice": true
}
}],
"customField": {
"title": "Notes for delivery",
"translatedTitle": "Notas de entrega",
"value": "Please call when outside"
},
"discount": {
"appliedCoupon": {
"code": "47d259d6-7d1e-4ea5-a75c79ca9bb1",
"couponId": "558b511f-6eb7-82d3-53fca7374dfa",
"name": "Summer sale"
}
}
}
return fullOrder;
}