Skip to content

Instantly share code, notes, and snippets.

@donutdan4114
Last active June 6, 2020 01:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donutdan4114/ed3a7745c07bc2c8e596880fc07640dc to your computer and use it in GitHub Desktop.
Save donutdan4114/ed3a7745c07bc2c8e596880fc07640dc to your computer and use it in GitHub Desktop.
<script src="https://cdn.apps.bonify.io/customer_fields/public/live/CustomerFieldsApp_Manual-min.js"></script>
<script>
if (typeof CustomerFieldsApp_Manual !== 'undefined') {
CustomerFieldsApp_Manual.init("#create_customer", {
base_url: "https://apps.bonify.io/",
site_id: "{{ shop.metafields.cf_app.internal_site_id }}",
shop_domain: "{{ shop.permanent_domain }}",
{% if customer %}
customer_id: "{{ customer.id }}",
customer_token: "{{ customer.metafields.cf_app.api_token }}",
{% endif %}
// Callback when new customer creation fails.
onNewCustomerFailure: function (data){
// @todo: Exists for demo purposes only, remove if not needed.
console.log(data.result.responseJSON.errors);
},
// Callback when updating a customer fails.
onUpdateCustomerFailure: function (data){
// @todo: Exists for demo purposes only, remove if not needed.
console.log(data.result.responseJSON.errors);
},
// Callback whenever a message should be displayed to the user.
onDisplayMessage: function(data){
// @todo: Exists for demo purposes only, remove if not needed.
console.log(data);
},
// Callback when a field has an error.
onFieldError: function (error){
// @todo: Exists for demo purposes only, remove if not needed.
console.log(error);
}
});
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment