Add_filter | Disable payment options (Product IDs)
This guide explains how to exclude specific payment product IDs from your payment options using the ag_exclude_product_ids filter.
Overview
By default, all available payment methods are presented to your customers during checkout. However, you may wish to exclude certain payment methods based on your business needs. The ag_exclude_product_ids filter allows you to customise which payment product IDs are excluded from the available payment options.
How to Exclude Payment Methods
Add the following code to your theme’s functions.php file or a custom plugin:
Steps:
- Locate the File: Open your theme’s
functions.phpfile or create a custom plugin. - Insert the Code: Copy and paste the code snippet above.
- Customize IDs: Replace
5408and5678with the payment product IDs you wish to exclude. Refer to the Worldline documentation for a list of IDs. - Save Changes: Save the file.
- Test: Check your checkout page to ensure the specified payment methods are excluded.
Notes
- Backup First: Always back up your site before making code changes.
- Clearing Cache: If changes don’t appear, clear your site’s cache.
Was this helpful?