<script>
try {
const redirect = 'https://excore-shopify-demo.experro.com/thank-you/';
const requiredFields = [
'customer',
'id',
'item_count',
'line_items',
'line_items_subtotal_price',
'name',
'order_id',
'order_name',
'order_number',
'total_price',
];
const modifiedCheckout = {};
for (const field of requiredFields) {
const checkoutFieldValue = Shopify.checkout[field];
if (checkoutFieldValue) {
modifiedCheckout[field] = checkoutFieldValue;
}
}
window.top.location.href = `${redirect}?c=${JSON.stringify(modifiedCheckout)}`;
} catch (e) {
console.error(e);
}
</script>