Smind Documentation
  • In-app
    • Getting started
    • Library
      • Product blocks
      • Sections
      • Templates
      • Themes
      • Styles
    • My library
    • Page Builder
    • Theme Builder
    • Subscription plans
    • Settings
    • Support
  • Guides
    • Color block and color scheme
    • Enabling account
    • Getting Google Maps iframe
    • Getting TikTok video URL
    • Configuring color swatches
    • Configuring sale badge
    • Configuring size chart
    • Showing social media icons
    • Deleting data
    • Moving Sections
  • Sections
    • Header
    • Product Detail
    • Product Bundles
    • Collection Page
      • Vertical Layout
      • Horizontal Layout
      • Off-Canvas Layout
      • Expand/Collapse Layout
    • Wishlist & Wishlist Page
    • Compare & Compare Page
    • Quick Add
    • Quick View
  • Cart Drawer
    • Estimate Shipping
    • Free Shipping Progress Bar
    • Complementary Product
    • Cart Notes
  • FAQs
    • Why does the section appear on all pages?
    • Why are section layouts broken?
    • Why do spaces appear when hiding the theme's header?
    • How to change default text in sections?
    • How to update sections?
    • How to set the default template for product pages?
    • Why are the sections I installed not showing up in the theme editor?
    • Integrate review scores from other apps.
  • Dev
    • Product detail event
    • Product form event
    • Cart Drawer event
Powered by GitBook
On this page
  1. Dev

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
        }
      })
PreviousProduct detail eventNextCart Drawer event

Last updated 1 month ago