The below is used to get products via bigcommerce api but will not work inside of the stencil environment because of cross-domain errors… Is there a way to make some form of api calls work within the theme? Maybe there are relative url endpoints to the api?
I want to do this because the catalog is not accessible through stencil's handlebars the way i need it for a theme i am working on
<script type="text/javascript">
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.bigcommerce.com/stores/***/v3/catalog/products?include=variants%2Ccustom_fields",
"method": "GET",
"headers": {
"x-auth-client": "d8zpoak96***",
"x-auth-token": "i64oipln27l***",
"cache-control": "no-cache",
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
</script>