Automating Wix Pricing Plan Checkout Data to CRM: A Velo Guide for Seamless Contact Management

Bridging the Data Gap: Integrating Wix Pricing Plan Checkout Information with CRM Contacts

As a Wix migration expert and community analyst, I frequently encounter scenarios where businesses seek to streamline their data management. A recent discussion on the Wix Studio community forum, titled originally "How do I get info gathered at checkout into the contact record?", highlighted a critical challenge for many store owners using Wix Pricing Plans: the automatic transfer of crucial checkout data into the respective contact records.

The user, running a site like "League of Glorious Nonsense" with pricing plans, articulated a common pain point: while Wix collects essential information like mailing addresses, allergy/accommodation details, and media release acceptance during the pricing plan checkout process (often via custom forms integrated into the checkout flow), this data doesn't automatically populate the customer's contact record in the Wix CRM. Their attempts with native Wix Automations proved futile because "custom forms for pricing aren't with the regular forms" and the "plan purchase trigger doesn't carry any of this data." This necessitates manual data retrieval from invoices or form submissions, a process that is inefficient and prone to errors.

The Solution: Leveraging Wix Velo for Robust Data Synchronization

The core problem lies in the limited scope of native Wix Automations for this specific scenario. While powerful for many tasks, they often lack the granular control needed when custom fields are involved in non-standard form contexts (like pricing plan checkouts). The most effective and scalable solution involves utilizing Wix Velo, Wix's open development platform. Velo allows you to write custom code to extend your site's functionality, including interacting with Wix APIs like Wix Stores and Wix CRM.

Prerequisites for Implementation:

  • Enable Developer Mode: In your Wix Editor or Wix Studio workspace, you'll need to enable Developer Mode to access the Velo sidebar and backend files.
  • Create Custom Fields in Wix CRM: Before you can populate these fields with data, you must first define them in your Wix CRM. Navigate to your CRM Contacts, go to "Settings" or "Manage Fields", and create new custom fields (e.g., "Mailing Address", "Allergy/Accommodation Info", "Media Release Acceptance") as text fields.

Step-by-Step Velo Implementation Guide

Here's how to implement a Velo solution to capture and transfer pricing plan checkout data into your contact records:

1. Set Up Your Backend Event Listener

All custom backend code for event handling resides in the backend folder of your Velo development environment. You'll need to create a file named events.js (if it doesn't already exist) to listen for Wix Stores events.

This file will contain the function that triggers when a pricing plan purchase is completed. Since pricing plans often use the Wix Stores checkout mechanism, we'll listen for the wixStores.onOrderPaid event.

2. Implement the onOrderPaid Event Handler

In your backend/events.js file, add the following structure. This function will execute every time an order is successfully paid.


// backend/events.js

import { contacts } from 'wix-crm.v2';
import { events } from 'wix-stores.v2';

export function wixStores_onOrderPaid(event) {
    console.log('Order Paid Event Received:', event);

    const order = event.order;

    // Ensure this is a pricing plan order, if necessary
    // You might need to check order.lineItems to confirm if it contains a specific pricing plan product

    const c
    if (!contactId) {
        console.error('No contactId found for this order.');
        return;
    }

    const customFieldsToUpdate = {};

    // 1. Extract Mailing Address
    if (order.billingInfo && order.billingInfo.address) {
        const address = order.billingInfo.address;
        customFieldsToUpdate['custom.mailingAddress'] = 
            `${address.streetAddress.addressLine1}, ` +
            `${address.streetAddress.addressLine2 ? address.streetAddress.addressLine2 + ', ' : ''}` +
            `${address.city}, ${address.subdivision}, ${address.postalCode}, ${address.country}`;
    }

    // 2. Extract Custom Form Fields (Allergy/Accommodation, Media Release)
    // This part is crucial and depends on how the custom fields are captured during checkout.
    // Inspect a sample order object in your Wix site's Data -> Store Orders to see where this data resides.
    // Common locations: order.lineItems[x].customFields, order.additionalInfo, order.extendedFields

    // EXAMPLE: Assuming custom fields are part of a line item's custom fields
    order.lineItems.forEach(item => {
        if (item.customFields) {
            item.customFields.forEach(field => {
                if (field.title === 'Allergy/Accommodation Info') {
                    customFieldsToUpdate['custom.allergyAccommodationInfo'] = field.value;
                } else if (field.title === 'Media Release Acceptance') {
                    customFieldsToUpdate['custom.mediaReleaseAcceptance'] = field.value;
                }
                // Add more custom fields as needed
            });
        }
    });

    if (Object.keys(customFieldsToUpdate).length > 0) {
        contacts.updateContact(contactId, customFieldsToUpdate)
            .then(updatedC> {
                console.log('Contact updated successfully:', updatedContact._id);
            })
            .catch(error => {
                console.error('Error updating contact:', error);
            });
    }
}

3. Inspect Your Order Object for Custom Field Paths

The most critical step for retrieving custom form data (like allergy info or media release acceptance) is to understand where Wix Stores places this information within the order object. Since the user noted that these are not "regular forms," they are likely integrated directly into the checkout flow for the pricing plan. To find the exact path:

  1. Make a test purchase of your pricing plan.
  2. Go to your Wix Dashboard > Store Products > Orders.
  3. Click on the test order to view its details.
  4. Look for the custom fields. If they are not immediately visible, you might need to use the "Inspect Element" feature in your browser or consult Wix support/documentation to understand where custom checkout fields are stored in the order object. Often, they appear within lineItems under a property like customFields, options, or additionalInfo.

Adjust the Velo code's data extraction logic (the section under "2. Extract Custom Form Fields") based on your findings. Remember to use the exact field titles or keys as they appear in the order object.

4. Map to CRM Custom Fields

In the Velo code, 'custom.mailingAddress', 'custom.allergyAccommodationInfo', and 'custom.mediaReleaseAcceptance' refer to the API field keys for your custom CRM fields. These keys are typically prefixed with 'custom.' followed by the camelCase version of your custom field's name (e.g., "Mailing Address" becomes "mailingAddress"). Double-check these against your CRM custom field settings.

Community Insight and Broader Implications

This forum topic highlights a recurring theme in the Wix ecosystem: while the platform offers extensive out-of-the-box functionality, specific, nuanced data synchronization needs often require a deeper dive into Velo. The inability of standard automations to handle custom checkout fields for pricing plans efficiently points to an area where Wix could enhance its native capabilities, perhaps by offering more flexible triggers or data mapping within the Automations app.

For store owners and developers, understanding the power of Velo is paramount. It transforms Wix from a robust website builder into a highly customizable platform capable of handling complex business logic. This approach not only solves the immediate problem of manual data entry but also lays the groundwork for further CRM integration, personalized customer experiences, and more efficient marketing automation.

Conclusion

By implementing a custom Velo solution using the wixStores.onOrderPaid event, Wix users can seamlessly bridge the gap between pricing plan checkout data and their CRM contact records. This eliminates manual data entry, improves data accuracy, and empowers businesses like "League of Glorious Nonsense" to maintain a comprehensive and up-to-date view of their members and customers, directly within their Wix environment. While it requires a bit of code, the efficiency gains and enhanced data integrity are well worth the effort.

Start with the tools

Explore migration tools

See options, compare methods, and pick the path that fits your store.

Explore migration tools