How to Clear the Gift Card Pro Form After a Gift Card Has Been Added to the Cart

When a Gift Card is configured and added to your cart by the customer, the browser caches their settings. This is a browser event that requires a small snippet of code to clear.

Above the closing </body> tag in your theme.liquid file, add this snippet of code:

<script>
// Clear the Gift Card Pro form after it is added to the cart
document.addEventListener('gcp-item-added', function() {

window.GCPSDK.form.set('properties._gcp_conversion_rate', "");
window.GCPSDK.form.set('properties._gcp_custom_value', "");
window.GCPSDK.form.set('properties._gcp_delivery_date', "");
window.GCPSDK.form.set('properties._gcp_delivery_time', "Send Now");
window.GCPSDK.form.set('properties._gcp_delivery_timezone', "");
window.GCPSDK.form.set('properties._gcp_iso_delivery_date', "");
window.GCPSDK.form.set('properties._gcp_locale', "");
window.GCPSDK.form.set('properties._gcp_message_from', "");
window.GCPSDK.form.set('properties._gcp_message_text', "");
window.GCPSDK.form.set('properties._gcp_recipient_email', "");
window.GCPSDK.form.set('properties._gcp_recipient_name', "");
window.GCPSDK.form.set('properties._gcp_recipient_phone', "");
window.GCPSDK.form.set('properties._gcp_send_to_self', false);
window.GCPSDK.form.set('properties._gcp_thumbnail_image', "");
window.GCPSDK.form.set('properties._gcp_thumbnail_url', "");
window.GCPSDK.form.set('properties._gcp_video_id', "");
window.GCPSDK.form.set('properties._gcp_video_url', "");

});
</script>

With this in place, the Gift Card Pro builder form will be clear when re-visited after a gift card has been built and added to the cart by one of your customers.

Can't find the answer in our documentation?
Contact Support