Created
July 3, 2022 15:50
-
-
Save webtoffee-git/b078df4b735c3d02b9db1768f9b3c875 to your computer and use it in GitHub Desktop.
Export URL Coupon details along with Coupon data into CSV - Order Export Import Plugin For WooCommerce (https://www.webtoffee.com/product/order-import-export-plugin-for-woocommerce/)
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
<?php // do not copy this line | |
add_filter('hf_alter_coupon_csv_header', 'wt_csv_coupon_add_more_columns', 10, 1); | |
function wt_csv_coupon_add_more_columns($csv_columns) { | |
$csv_columns['meta:_wc_url_coupons_unique_url'] = 'meta:_wc_url_coupons_unique_url'; | |
$csv_columns['meta:_wc_url_coupons_redirect_page'] = 'meta:_wc_url_coupons_redirect_page'; | |
$csv_columns['meta:_wc_url_coupons_redirect_page_type'] = 'meta:_wc_url_coupons_redirect_page_type'; | |
$csv_columns['meta:_wc_url_coupons_product_ids'] = 'meta:_wc_url_coupons_product_ids'; | |
$csv_columns['meta:_wc_url_coupons_defer_apply'] = 'meta:_wc_url_coupons_defer_apply'; | |
return $csv_columns; | |
} | |
add_filter('hf_alter_coupon_csv_data', 'wt_csv_coupon_add_more_data', 10, 1); | |
function wt_csv_coupon_add_more_data($coupon_data) { | |
$coupon_id = $coupon_data['ID']; | |
$coupon_data['meta:_wc_url_coupons_unique_url'] = get_post_meta( $coupon_id, '_wc_url_coupons_unique_url' , TRUE); | |
$coupon_data['meta:_wc_url_coupons_redirect_page'] = get_post_meta( $coupon_id, '_wc_url_coupons_redirect_page' , TRUE); | |
$coupon_data['meta:_wc_url_coupons_redirect_page_type'] = get_post_meta( $coupon_id, '_wc_url_coupons_redirect_page_type' , TRUE); | |
$product_ids = get_post_meta( $coupon_id, '_wc_url_coupons_product_ids' , TRUE); | |
$coupon_data['meta:_wc_url_coupons_product_ids'] = (!empty(($product_ids))) ? implode(',', $product_ids): ''; | |
$coupon_data['meta:_wc_url_coupons_defer_apply'] = get_post_meta( $coupon_id, '_wc_url_coupons_defer_apply' , TRUE); | |
return $coupon_data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment