4 min read • Updated 8 days ago

Create a purchase form with Webflow's Form Builder

In this article we show you how to use Webflow's form builder to setup a purchase form to sell any type of product or service. We'll cover how to handle different product types later in the article.


Add Foxy Code Snippet

To display the sidecart when a customer adds a product to cart and to store customer sessions, you must first load the needed Foxy loader file into your website.

  1. 1

    In the Foxy admin, click on the Sample Code link under the Store column in the navigation at top.

  2. 2

    Copy the code snippet from Step 1.

  3. 3

    In Webflow, go to your Site Settings and click on the Custom Code link at top.

  4. 4

    Paste the copied code snippet into the Footer Code section and save changes.


Setup Purchase Form

Please note that when designing your purchase form, customer and billing information (ex: name, email, credit card #) will be collected on the checkout page, so there is no need to add those fields to your form.

  1. 1

    Using Webflow's form builder, build and design your purchase form as desired.

  2. 2

    Give each form field a proper name. For example, "Color".


Add Foxy Specific Fields

To create a legitimate product, Foxy requires (at minimum) the product name and price. The following steps will show you how to add these hidden fields using a select field since setting a default value for input fields is not currently allowed in Webflow.

  1. 1

    Once you've added all of your fields, add an additional select field. This field will be used for your product name.

  2. 2

    In the Input Settings, set the field name as name

  3. 3

    In your select field's choices, set the first choice value as your product name. For example, "Test Product".

  4. 4

    Add another select field and give it the name price . This field will be used for your product price.

  5. 5

    In your select field's Choices, set the first choice value as your product price. For example, "9.99".

  6. 6

    For both the name and price select fields, set the Display Setting to "None". This will hide these fields from customers.

  7. 7

    Repeat steps for any additional fields you want hidden.


Set Form Action

  1. 1

    By default, form data is submitted to Webflow's servers. The following steps will show you how to send data to Foxy.

  2. 2

    Go back to the Sample Code page in the Foxy admin. Copy the form action url from the Step 2 section.

  3. 3

    In Webflow, go to your Form Settings. Paste the form action URL into the Action field.

  4. 4

    Change the Method to POST

  5. 5

    Publish changes and test purchase form to ensure it works as expected.


Different Product Types

You can use Webflow's form builder to sell any type of product. Below are extra steps required for the different product types.

Subscriptions (recurring payments)

  1. 1

    Add a select field to your form

  2. 2

    In the form field settings, set the field name as sub_frequency

  3. 3

    In the choices settings for this field, set the value of the first choice as desired frequency (ex: 1d, 2w, 1m, 1y)

  4. 4

    Hide the select field using Webflow's visibility settings or by applying styling (ex: display: none)

  5. 5

    Alternatively, you can keep the select field visible and assign a different frequency value to each choice.

Donations

  1. 1

    Remove the hidden select field with the name price

  2. 2

    Add an input field to your form, where you want donors to be able to input their donation amount.

  3. 3

    Set the input field name as price


Product Variants

For certain products you may need to allow the customer to choose from different variants (ex: Size). We recommend using select and/or radio fields.

  1. 1

    Add select or radio field to your form.

  2. 2

    In the input settings, give the field a proper name (ex: Size).

  3. 3

    Add each option as needed (ex: Small, Medium, Large, X-Large, 2X-Large)

  4. 4

    Using Foxy's Product Option Modifiers you can modify the product price, weight, category, and code based on the option your customer chooses.

  5. 5

    For each option that has a modifier, add the proper syntax to the option value. An example would look like this: 2X-Large{p+2)


Display A Quantity Field

Quantity can be modified once a product is in the cart, but if you want to allow customers to choose a quantity before adding a product to cart, simply add a form field with the Name set as "quantity" (lowercase q). This can be an input field, select field, etc.


Need Help?

Did this article answer your questions? Need help with anything? Please click below to contact us.