Docs & Support

Learn about all the Formidable features and get support from our amazing customer success team.

wc_fp_include_field_in_cart

Heads up! This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or third-party development.

Use the wc_fp_include_field_in_cart filter to choose which form fields show with a product in the WooCommerce cart. The same choice applies to the order: a field this filter hides isn't saved with the order item. So it doesn't show on the order confirmation page, on the order screen in the admin area, or in the WooCommerce order emails.

The submitted values stay in the Formidable entry. This filter only changes what WooCommerce shows and saves with the product.

Requirements

Formidable Forms makes advanced site building simple. Launch forms, directories, dashboards, and custom WordPress apps faster than ever before.

How it works

When a product with a form is added to the cart, the WooCommerce add-on lists the submitted fields under the product name. By default, it leaves out these fields:

  • Fields with an empty value.
  • The field that sets the product total.
  • Fields of these types: Paragraph, Rich Text, Captcha, Signature, User ID, Password, HTML, Section, Embed Form, Tags, and Hidden. To change this list, use the wc_fp_exclude_fields hook.
  • Fields the current user can't see because of the field's visibility setting.

This filter runs last, for every field. Return true to show a field, even one of the types above. Return false to hide it.

The add-on runs the same check when the order is placed and saves the shown fields with the order item. Orders placed before you add the filter keep the fields they were saved with.

Usage

add_filter( 'wc_fp_include_field_in_cart', 'frm_show_field_in_cart', 10, 3 );

Parameters

  • $display (bool): true when the field shows by default.
  • $field (object): The field. Use $field->id, $field->field_key, or $field->type to pick fields.
  • $value (mixed): The submitted value of the field. It's an array for fields with several values, such as checkboxes.

Examples

Learn where to put the code when adding a custom PHP function to your site.

Include or exclude fields in cart

Use this example to choose which fields show in the WooCommerce cart, on the order, and in the WooCommerce order emails. Replace 123, 345, and 456 with the IDs of the fields you want to show. Replace 987, 765, and 543 with the IDs of the fields you want to hide.

add_filter( 'wc_fp_include_field_in_cart', 'frm_show_field_in_cart', 10, 3 );
function frm_show_field_in_cart( $display, $field, $value ) {
    if ( in_array( $field->id, array( '123', '345', '456' ) ) ) {
        $display = true;
    } else if ( in_array( $field->id, array( '987', '765', '543' ) ) ) {
        $display = false;
    }

    return $display;
}

A field's ID shows at the top of its field options in the form builder.

Was this article helpful? *

This article may contain affiliate links. Once in a while, we earn commissions from those links. But we only recommend products we like, with or without commissions.

In this article

    We have a small, but amazing team of dedicated people who are committed to helping you achieve your goals and project requirements.


    Copyright © 2026 Strategy11, LLC. Formidable Forms® is a registered trademark Strategy11, LLC.

    Complete your purchase
    Don't forget your purchase!
    Complete Purchase
    Join 400,000+ using Formidable Forms to create form-focused solutions fast. Get Formidable Forms