I wanted to get the order line items in backend for custom fulfilment. and was unable to do it. The Order LinIitems are not available in OnNewOrder event. After trying in vain for 3 weeks to get the OrderLine items I gave up on it
Tried to create an order from cart items as per the https://www.wix.com/corvid/reference/wix-stores-backend/createorder
I get this error
order is invalid: -- shippingInfo is invalid:
– details.pickupDetails is invalid:
|-- buyerDetails is invalid:
|-- email is not a valid email address
-- phone is not a valid phone number
– pickupAddress is invalid:
`-- country is not a valid 2-letter country code
//here is the front end code
import {createOrder} from 'backend/Orders';
export async function CheckoutButton_click(event) {
let cart = await getCurrentCart();
let NewOrder = createOrder(cart);
console.log("Order ID " + NewOrder._id);
console.log("created order");
}
//Backend code
import wixStoresBackend from 'wix-stores-backend';
export function createOrder(Cart) {
let minimumOrder = {};
minimumOrder = {
"lineItems":Cart.lineItems,
"totals":Cart.totals,
"channelInfo": {"type": "WEB"},
"paymentStatus": "NOT_PAID",
"shippingInfo":Cart.shippingInfo,
"billingInfo":Cart.billingInfo
}
return wixStoresBackend.createOrder(minimumOrder);
}
Please help fix this. I have no idea where to get the pickup details etc that are showing up in the error. If this too does not work . I may have to look at moving out of Wix