Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Add the custom column to the exporter and the exporter column menu.
- *
- * @param array $columns
- * @return array $columns
- */
- function add_export_column( $columns ) {
- $columns['_lottery_pn_answers'] = 'Meta: _lottery_pn_answers';
- return $columns;
- }
- add_filter( 'woocommerce_product_export_column_names', 'add_export_column' );
- add_filter( 'woocommerce_product_export_product_default_columns', 'add_export_column' );
- /**
- * Provide the data to be exported for one item in the column.
- *
- * @param mixed $value (default: '')
- * @param WC_Product $product
- * @return mixed $value - Should be in a format that can be output into a text file (string, numeric, etc).
- */
- function add_export_data( $value, $product ) {
- $value = $product->get_meta( '_lottery_pn_answers', true, 'edit' );
- return maybe_serialize ( $value );
- }
- // Filter you want to hook into will be: 'woocommerce_product_export_product_column_{$column_slug}'.
- add_filter( 'woocommerce_product_export_product_column__lottery_pn_answers', 'add_export_data', 10, 2 );
Add Comment
Please, Sign In to add comment