Created
January 8, 2019 16:43
-
-
Save lucasstark/7d7ed93efa505f333e599732cfeba24c to your computer and use it in GitHub Desktop.
Attempt to remove GRavity Form price labels from items added to the WooCommerce cart.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_gforms_get_item_data', function ( $data, $field, $lead, $form_meta ) { | |
if ( strpos( $data['display'], '(' ) !== false && strpos( $data['display'], ')' ) !== false ) { | |
$data['display'] = substr( $data['display'], 0, strpos( $data['display'], '(' ) ); | |
} | |
return $data; | |
}, 10, 4 ); | |
add_filter( 'woocommerce_gforms_field_display_text', function ( $value, $text, $field ) { | |
if ( strpos( $value, '(' ) !== false && strpos( $value, ')' ) !== false ) { | |
$value = substr( $value, 0, strpos( $value, '(' ) ); | |
} | |
return $value; | |
}, 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment