Created
June 15, 2015 20:17
-
-
Save ameeker/746dbe2c46cd4d3978c3 to your computer and use it in GitHub Desktop.
Add WooCommerce Order ID column to Gravity Forms export
This file contains hidden or 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( 'gform_export_fields', 'add_fields', 10, 1 ); | |
| function add_fields( $form ) { | |
| array_push( $form['fields'], array( 'id' => 'orderid', 'label' => __( 'Order ID', 'gravityforms' ) ) ); | |
| return $form; | |
| } | |
| add_filter( 'gform_export_field_value', 'set_export_values', 10, 4 ); | |
| function set_export_values( $value, $form_id, $field_id, $lead ) { | |
| switch( $field_id ) { | |
| case 'orderid' : | |
| $value = 'echo $order->id;'; | |
| break; | |
| } | |
| return $value; | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The first example returns the form id; the second returns a 0.