@jcampos Yeah the way I was doing it now is to use location on the thank you page to get order id. Once you have that, you can pretty much get any info right? My issue is wanting to tie into existing Orders/notification framework. Otherwise you would have to do your own notifications, but maybe you are doing that? Also, you can use buyerid as the link between order and cart.
Tom
Adas…did you get to contact the developers to fix the bug ?
Hi, we have exposed additional address fields for Stores/Orders collection.
{
formatted : string ;
country ?: string ;
subdivision ?: string ;
city ?: string ;
postalCode ?: string ;
streetAddress ?: {
number : string ;
name : string ;
};
addressLine ?: string ;
location ?: string ;
}
please note the “?” mean that the field is optional
e.g.: billingInfo.address=
{
“formatted” : “New York, NY, USA\nNew York, New York 111212\nUnited States\n0254545454” ,
“city” : “New York” ,
“country” : “USA” ,
“addressLine” : “New York, NY, USA” ,
“postalCode” : “111212” ,
“subdivision” : “NY”
}
@zeevg Thanks Zeev…this seems to solve the address problem…I will make some tests to show our client that now we can get the complete Address.
it should be noted that not only billling address is complete, but also shipping address now is complete too…
@jcampos yes all address fields now contain full address data. the screenshot is an example.
Happy to help
@zeevg See if it is possible for you to help with this :
Loggi is the shipping company we are using here…the shipping cost is based on distance (KM)…they have ana Rest API that returns the shipping cost if you provide GPS location to them…
We need to have a custom shipping cost field on the Wix Store checkout , so we can call Loggi integration and get the shipping cost of a delivery. The user fills the postal code field and a backend routine call Fetch to get from Loggi the shipping cost.
This is important and urgent for us, because we are lossing sales for not having this option ( access to the checkout page fields and make this integration…
Can you help or ask someone else to help us it this issue ?
@jcampos currently we don’t support this functionality.
One way of solving this would be Wix to release the On Line Ordering Shipping option available on Wix Restaurant Library ( already develop) in the Wix Store…This would solve our shipping problem since we could use the designed region to calculate the shipping price…
To whom we can address this inside WIx?
Yes I agree! @zeevg Is wix doing anything about this?
Currently this is not supported
Simple field references, like event.totals.total, work fine.
Billing and shipping fields don’t seem to work.
Here’s an example for billing city.
import wixData from ‘wix-data’;
import wixStores from ‘wix-stores-backend’
export function wixStores_onNewOrder(event) {
let bcity = event.billingInfo.address.city;
wixData.insert('test, {‘billingCity’: bcity})
}
Thanks,
David
This is in events.js, the typo for the Collection is only in the entry - it’s correct in events.js.
Thanks.
It looks like either a bug the new Stores/Orders or the implementation is not complete yet.
This maps from JSON in events.js correctly:
“order”: event.number
One level of nest works fine also:
“total”:event.totals.total
“buyeremail”:event.buyersInfo.email
None of the sections that include an additional level of nesting appears to be available.
billingInfo and shippingInfo can not be accessed with this syntax; neither is an Array.
This doesn’t work for this level of nesting:
“billingCity”:event.billingInfo.address.city
None of the values in billingInfo or shippingInfo seem accessible either:
“bfirstName”:event.billingInfo.firstName
Could a Wix moderator comment?
Thank you,
David
Your example approach works for only certain field sections of orders.
For instance, buyersInfo.email works, but billingInfo.email and shippingInfo.email don’t.
None of the fields for billingInfo, shippingInfo and Items can be retrieved with this approach.
Have these been made inaccessible to this format?
Thanks,
David
I am also not getting correct results when querying stores/orders. all I get is the following result from the code below. Please help us Wix team
my result is :
“[{“orderId”:“9b58f57d-a84d-4cbf-8bd9-c38e0ebf5337”,“number”:“10025”,“dateCreated”:“2019-11-26T07:56:50.624Z”,“buyerInfo”:{“id":“b326aa2c-1000-4767-97ed-ccc8a5a57923”,“identityType”:“MEMBER”,“firstName”:“Ross”,“lastName”:“Davis”,“phone”:“800=555-1212”,“email”:"ross@dataanywhere.net”},“currency”:“CAD”,“weightUnit”:“KG”,“totals”:{“subtotal”:214,“shipping”:35,“tax”:29.88,“discount”:0,“total”:278.88,“weight”:20.4,“quantity”:12},“paymentStatus”:“NOT_PAID”}]”
}
Where are all of the other fields like lineItems?
export function wixStores_onNewOrder(event) {
let newOrderId = event.orderId;
let totalPrice = event.totals.total;
console.log(‘Order ID in new Order is : ‘+newOrderId);
console.log(event);
console.log(‘end of on new order’);
wixData.query(‘Stores/Orders’)
.eq(‘number’, event.number)
.eq(’_id’, event.orderId)
.limit(1)
.find()
.then(res => {
let count=res.totalCount;
if ( count === 1) { // Double check that we found the one item that we should have found
console.log(res);
console.log(res.lineItems);
console.log(‘after lineitems’);
}
});
}
Yes, that doesn’t work. The process turns out to be different. I’m publishing “How to use Corvid to create Data Collections from Stores/Orders DB using Corvid” shortly; it has complete templates as well as explanations for all Code.
Best regards,
David