https://github.com/wpup/wc-export
Export various data from WooCommerce
https://github.com/wpup/wc-export
Last synced: 11 months ago
JSON representation
Export various data from WooCommerce
- Host: GitHub
- URL: https://github.com/wpup/wc-export
- Owner: wpup
- License: mit
- Created: 2016-07-18T08:36:07.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2019-12-02T14:24:21.000Z (over 6 years ago)
- Last Synced: 2025-06-02T08:47:07.719Z (about 1 year ago)
- Language: PHP
- Homepage:
- Size: 58.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WooCommerce Export
[](https://travis-ci.org/wpup/wc-export)
[](http://unmaintained.tech/)
Export various data from WooCommerce.
The plugin cames with two exporters, a customers export that will export all billing fields and a emails exporter that will export the billing email field from a order.
The are three writers built in, CSV, XML and JSON.
## Installation
```sh
composer require frozzare/wc-export
```
## Documentation
* [Custom export](#custom-export)
* [Custom writer](#custom-writer)
### Custom export
Example of a custom export type that will export the `billing_email` field from a order. With `query_args` method you can modify the `WP_Query` arguments.
```php
__( 'Email', 'woocommerce' )
];
}
/**
* Modify WP Query args.
*
* @param array $args
*
* @return array
*/
public function query_args( array $args ) {
return $args;
}
}
```
Then you have to add the custom export to the exporter list with `wc_export_classes` filter.
```php
'\\Custom_Emails'
] );
} );
```
### Custom writer
Example of a custom export writer that will export the given data argument to `render` method as JSON.
```php
$row ) {
if ( ! is_array( $row ) ) {
unset( $data[$index] );
}
}
echo json_encode( $data, JSON_UNESCAPED_UNICODE );
}
}
```
Then you have to add the custom writer to the writers list with `wc_export_writers` filter.
```php
'\\Custom_JSON'
] );
} );
```
## License
MIT © [Fredrik Forsmo](https://github.com/frozzare)