Remove Field Label from Option Fields in Order Summary

By default, Gravity Forms displays options in order summary like so: Field Label: Option Label

With this snippet in place, options will be displayed as: Option Label

Instructions

Code

Filename: gpecf-remove-field-label-from-option-label.php

<?php
/**
 * Gravity Perks // eCommerce Fields // Remove Field Label from Option Fields in Order Summary
 * https://gravitywiz.com/documentation/gravity-forms-ecommerce-fields/
 *
 * Instruction Video: https://www.loom.com/share/87f6010d6e624e4c9433699cabaf846b
 *
 * By default, Gravity Forms displays options in order summary like so:
 * Field Label: Option Label
 *
 * With this snippet in place, options will be displayed as:
 * Option Label
 */
add_filter( 'gform_product_info', function( $product_info ) {
	foreach ( $product_info['products'] as &$product ) {
		if ( ! empty( $product['options'] ) ) {
			foreach ( $product['options'] as &$option ) {
				$option['option_label'] = $option['option_name'];
			}
		}
	}
	return $product_info;
} );

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.