Hi,
I’m contacting you in connection with my previous ticket https://www.8theme.com/topic/woocommerce-pdf-invoices-custom-macros/#post-447446. I am experiencing a critical issue with WooCommerce PDF Invoice plugin (by RightPress) on my XStore theme website. I need to add custom macros for business requirements (IČO, DIČ, IČ DPH) or (ID, Tax ID, VAT ID) to PDF invoices, but despite multiple attempts and code implementations, the custom macros are not appearing in the generated PDF documents.
What I’m Trying to Achieve
I need to add these specific macros to my WooCommerce PDF invoices:
{{billing_ic}} – Company Registration Number (IČO)
{{billing_dic}} – Tax ID Number (DIČ)
{{billing_ic_dph}} – VAT Number (IČ DPH)
These are standard business requirements for my countries’ invoices and should pull data from WooCommerce billing fields.
Current Setup
Theme: XStore (latest version)
Plugin: WooCommerce PDF Invoice by RightPress
WordPress: Latest version
WooCommerce: Latest version
Server: Standard hosting environment
What We Know About the Plugin
Through debugging, I discovered that the plugin uses these WordPress hooks and filters:
Active Plugin Hooks:
woo_pdf_macros – Priority: 10, Callbacks: 4
rightpress_pdf_template_data – Priority: 10, Callbacks: 1
rightpress_pdf_settings_defaults – Priority: 10, Callbacks: 1
Available Standard Macros:
The plugin includes standard macros like:
{{order_number}}
{{order_date}}
{{billing_first_name}}
{{billing_last_name}}
{{billing_company}}
{{total}}
Code Attempts Made
I have tried multiple approaches to add custom macros:
Method 1: Using woo_pdf_macros filter
phpadd_filter('woo_pdf_macros', function($macros) {
$macros['billing_ic'] = 'SK123456789';
$macros['billing_dic'] = 'SK2023456789';
$macros['billing_ic_dph'] = 'SK2023456789';
return $macros;
}, 10);
Method 2: Using rightpress_pdf_template_data filter
phpadd_filter('rightpress_pdf_template_data', function($data) {
$data['macros']['billing_ic'] = get_post_meta($data['order_id'], '_billing_ic', true);
return $data;
}, 10);
Method 3: Direct macro registration
phpadd_action('init', function() {
if (function_exists('woo_pdf_add_macro')) {
woo_pdf_add_macro('billing_ic', 'Company ID');
}
});
Current Problem
Despite all attempts:
Custom macros don’t appear in the PDF invoice
Debug logs show that filters are being called
Standard plugin macros work perfectly
No PHP errors are generated
Plugin hooks are active but custom macros are ignored
Debug Information
Plugin debug shows:
woo_pdf_macros filter has 4 callbacks active
Custom filter callbacks are being added (priority 999 visible)
No error messages in debug.log
Template rendering works for standard macros only
Previous Support Attempts
I have attempted to contact RightPress support for this WooCommerce PDF Invoice plugin issue but have been waiting several days without response. Since this is affecting me deeply and XStore is my theme, I’m hoping you could provide guidance or assistance.
Thank you for your time and support.
Best regards,
Filip