Product form event

Product form Add To Cart before submit.

  • To append custom data to the form data of Smind sections before submission, you can listen to the "smind:product-form:before-submit" event.

document.addEventListener('smind:product-form:before-submit', (event) => {
    try {
        const formData = event.detail.formData;

        if (this.sectionId === formData.get('section-id')) {
            formData.append('custom_key', custom_value);
        }
    } catch (error){
        console.log('error: ', error)
    }
});
custom_value: This is the element you want to add to the Smind add-to-cart form.

  • After completing the "Add to Cart" action with a product using Smind's section, if you want to perform additional actions after the submission is completed, you can listen to the "smind:product-form:submit-complete" event.

document.addEventListener('smind:product-form:submit-complete', (event) => {
        try {
         // Handle the action you want to perform after adding to cart here.
        } catch (error) {
          console.log('error: ', error
        }
      })

Last updated