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 | |
// See: https://www.simbahosting.co.uk/s3/faqs/when-downloading-a-detailed-csv-how-can-i-add-an-extra-column/ | |
// Set the list of desired columns for the spreadsheet | |
add_filter('wc_eu_vat_compliance_csv_header_columns', function() { | |
$desired_columns = [ | |
'Order number', | |
'Date (local)', |
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 | |
if (!defined('ABSPATH')) die('No direct access.'); | |
add_filter('wc_eu_vat_certify_message', function($msg) { return 'For the correct carrying out of VAT auditing regulations, please confirm your country of residence:'; }); | |
// Below: adding columns to the spreadsheet | |
// Make sure that the order meta field 'PayPal Transaction Fee' is fetched from the database when selecting data for the report. | |
add_filter('wc_eu_vat_compliance_report_meta_fields', 'my_wc_eu_vat_compliance_report_meta_fields', 10, 2); |
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 | |
// Install as an mu-plugin, and use something like WP-Crontrol to add a regular repeating call of the purge_vfb_data action | |
if (!defined('ABSPATH')) die('No direct access'); | |
add_action('purge_vfb_data', 'my_purge_vfb_data', 10, 1); | |
function my_purge_vfb_data($days = 90) { | |
global $wpdb; | |
$post_ids = $wpdb->get_col($wpdb->prepare("SELECT ID FROM ".$wpdb->posts." WHERE post_type='vfb_entry' AND post_date < DATE_SUB(NOW(), INTERVAL %d DAY);", $days)); |