Unable to get order id on bigcommerce store confirmation page

Viewed 19

I am trying to get order id on confirmation page of big-commerce store after placing an order according to the following code:

fetch('/api/storefront/order/{{checkout.order.id}}', {credentials: 'include'})
.then(function(response) {
return response.json();
})
.then(function(myJson) {
console.log(myJson);
});

But I am getting the following error:

{title: 'Not Found', type: 'about:blank', status: 404, detail: "Provided order Id doesn't represent a valid order"}

1 Answers

That code looks correct to me. In what file have you placed the code? It should be in order-confirmation.html

Related