WooCommerce Integration Hooks
woocommerce_payment_gateways
Registers the ZIGI payment gateway class with WooCommerce. Type: FilterFile:
paga-con-zigi.php:27Function:
zigi_payment_add_gateway_class
woocommerce_update_options_payment_gateways_zigi_payment
Triggered when admin saves the payment gateway settings. Type: ActionFile:
paga-con-zigi.php:90Class Method:
Zigi_Payment_WC_Gateway::process_admin_options
WordPress Core Hooks
before_woocommerce_init
Declares compatibility with WooCommerce High-Performance Order Storage (HPOS). Type: ActionFile:
paga-con-zigi.php:39Function:
zigi_payment_hpos_compatibilityPriority: 10 (default)
This hook ensures the plugin works correctly with WooCommerce’s modern order storage system introduced in WooCommerce 7.0+.
plugins_loaded
Initializes the payment gateway class after all plugins are loaded. Type: ActionFile:
paga-con-zigi.php:52Function:
zigi_payment_init_gateway_classPriority: 11
Asset Enqueue Hooks
admin_enqueue_scripts
Enqueues admin scripts and styles for the gateway settings page. Type: ActionFile:
functions.php:18Function:
zigi_payment_admin_script
wp_enqueue_scripts
Enqueues frontend scripts, styles, and localized data for the payment popup. Type: ActionFile:
functions.php:99Function:
zigi_payment_front_script
Upload and File Handling Hooks
upload_dir
Modifies the upload directory to store payment receipts in a custom subdirectory. Type: FilterFile:
functions.php:169Function:
zigi_payment_qr_code_upload_dir
AJAX Hooks
wp_ajax_zigi_payment_qr_code
Handles receipt upload for logged-in users. Type: ActionFile:
functions.php:200Function:
zigi_payment_qr_code_callback
wp_ajax_nopriv_zigi_payment_qr_code
Handles receipt upload for non-logged-in users (guests). Type: ActionFile:
functions.php:201Function:
zigi_payment_qr_code_callback
Security Features:
- Nonce verification for CSRF protection
- File type validation (only images allowed)
- File sanitization and validation
- Secure file naming with timestamps
Order and Meta Box Hooks
add_meta_boxes
Adds a meta box to display the payment receipt on order edit pages. Type: ActionFile:
functions.php:214Function:
zigi_payment_meta_box
Frontend Display Hooks
wp_footer
Outputs the payment popup HTML in the site footer. Type: ActionFile:
functions.php:72Function:
zigi_payment_popup
Hook Priority Reference
Understanding Hook Priorities
Understanding Hook Priorities
The plugin uses specific priorities to ensure correct execution order:
- Priority 10 (default): Most hooks run at default priority
- Priority 11:
plugins_loaded- ensures WooCommerce is loaded first - Priority 20: Can be used to run after plugin’s main hooks
Complete Hook List
| Hook Name | Type | File | Function | Priority |
|---|---|---|---|---|
woocommerce_payment_gateways | Filter | paga-con-zigi.php:27 | zigi_payment_add_gateway_class | 10 |
before_woocommerce_init | Action | paga-con-zigi.php:39 | zigi_payment_hpos_compatibility | 10 |
plugins_loaded | Action | paga-con-zigi.php:52 | zigi_payment_init_gateway_class | 11 |
woocommerce_update_options_payment_gateways_zigi_payment | Action | paga-con-zigi.php:90 | process_admin_options | 10 |
admin_enqueue_scripts | Action | functions.php:18 | zigi_payment_admin_script | 10 |
wp_footer | Action | functions.php:72 | zigi_payment_popup | 10 |
wp_enqueue_scripts | Action | functions.php:99 | zigi_payment_front_script | 10 |
upload_dir | Filter | functions.php:169 | zigi_payment_qr_code_upload_dir | 10 |
wp_ajax_zigi_payment_qr_code | Action | functions.php:200 | zigi_payment_qr_code_callback | 10 |
wp_ajax_nopriv_zigi_payment_qr_code | Action | functions.php:201 | zigi_payment_qr_code_callback | 10 |
add_meta_boxes | Action | functions.php:214 | zigi_payment_meta_box | 10 |
Next Steps
Customization Guide
Learn how to customize and extend the plugin
Troubleshooting
Common issues and solutions