Skip to content

Instantly share code, notes, and snippets.

@iurevych
Last active August 30, 2019 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iurevych/db861977962be1d4b8295c8de1be165f to your computer and use it in GitHub Desktop.
Save iurevych/db861977962be1d4b8295c8de1be165f to your computer and use it in GitHub Desktop.
// Order confirmation page aka post purchase
if (Shopify && Shopify.checkout) {
var _checkout = Shopify.checkout;
_q.push(['register_purchase', {
email: _checkout.email,
order_number: _checkout.order_id,
subtotal: _checkout.total_price,
coupon_code: _checkout.discount && _checkout.discount.applicable ? _checkout.discount.code : null
}]);
} else {
// some non post-purchase stuff goes here that is loaded on every page.
// I removed it to focus attention on the code snippet under question.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment