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 Hide the “Send to Myself” Checkbox in the Gift Card Form
Hide the Price Summary Section on the First Step of the Gift Card Pro Builder Form
Adding a Header and Footer Section to your Gift Card Pro Storefront Pages
Skip the First (Choose A Design) Step of the Gift Card Pro Builder Form
Centering the Gift Card Pro form on your Storefront
Updating the Fonts Used by the Gift Card Pro on your Storefront
Preventing “Hidden” Line Item Properties from Displaying on Your Store
Adding a Gift Card Terms and Conditions Page to your Online Store
How to Clear the Gift Card Pro Form After a Gift Card Has Been Added to the Cart
Using CSS Overrides to Change the Design / Layout of the Gift Card Form