Adding customizations to POP with the Code Snippets plugin
Goal
Add a small customization (e.g. modify a POP filter) without touching the theme’s functions.php and
without creating a dedicated plugin.
Prerequisites
- Administrator access to
wp-admin. - A valid PHP snippet to insert (written by you or provided by POP support).
Steps
- Install the free Code Snippets plugin from
wp-admin > Plugins > Add New, then activate it. - In the side menu, open Snippets > Add New.
- Give it a descriptive title (e.g. “POP - disable invoice number for payment method X”).
- Paste the PHP code into the dedicated area. Do not include the
<?phptag: it’s already included automatically, and duplicating it causes a fatal error. - If there are syntax errors, the editor flags them before you save.
- Leave the “Run snippet everywhere” option active for server-side hooks (
add_filter,add_action) used by the POP plugin. - Save and activate the snippet.
- Verify the behavior on the site (e.g. in sandbox, if the snippet affects invoice generation).
Real POP hook examples usually involved
These filters exist in the plugin’s code and are meant to be customized via snippet, without modifying the plugin files:
wc_el_inv-disabled_set_invoice_number— to prevent the invoice number from being assigned under specific conditions (e.g. a particular payment method).wc_el_inv-invoice_create_xml_by_order_status— to change the order status that triggers XML generation (defaultcompleted).wc_el_inv-stamp_duty_name— to rename the “Stamp Duty” line item on the invoice.wc_el_inv-options-capability— to change the WordPress capability required to access POP settings (default is the administration/WooCommerce management capability).
Verify
After activating the snippet, reproduce the scenario you wanted to change (e.g. generate a test order) and check that the behavior matches what you expected.
Common errors
- Fatal error after saving — almost always caused by including
<?phpagain, or a missing comma/parenthesis: the editor flags the line. - The snippet has no effect — check that it’s set to “Run everywhere” (not just admin or just frontend, depending on where the hook is needed) and that it’s actually active (not just saved).
- You’re not sure whether a filter still exists after an update — check the plugin changelog: hook names can change between major versions.
Related configuration
For the checkout field names these snippets often act on, see checkout-field-names.