Last active
November 14, 2025 13:28
-
-
Save xlplugins/bc18d6c79a11b1188a502d5b64d2067c to your computer and use it in GitHub Desktop.
Funnelkit Checkout: Allow hyperlink in the custom fields label
This file contains hidden or 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
| if ( ! class_exists( 'WFACP_Custom_Checkbox_Label' ) ) { | |
| #[AllowDynamicProperties] | |
| class WFACP_Custom_Checkbox_Label { | |
| public $checkbox_label = 'I have read and agree to the website <a href="#">Custom Link</a>'; | |
| public function __construct() { | |
| // Hook only after FunnelKit checkout page is found | |
| add_action( 'wfacp_after_checkout_page_found', [ $this, 'init' ] ); | |
| } | |
| /** | |
| * Initialize the label modification | |
| * This only runs on FunnelKit checkout pages | |
| */ | |
| public function init() { | |
| // Add filter to modify form field arguments | |
| add_filter( 'woocommerce_form_field_args', [ $this, 'modify_checkbox_label' ], 10, 2 ); | |
| } | |
| /** | |
| * Modify the checkbox label for the custom field | |
| * | |
| * @param array $args Field arguments | |
| * @param string $key Field key/ID | |
| * @return array Modified field arguments | |
| */ | |
| public function modify_checkbox_label( $args, $key ) { | |
| // Check if this is the custom checkbox field | |
| if ( $key === 'checkboxlabel' && isset( $args['type'] ) && $args['type'] === 'checkbox' ) { | |
| // Modify the label text here | |
| $args['label'] = $this->checkbox_label; | |
| } | |
| return $args; | |
| } | |
| } | |
| // Initialize the class | |
| new WFACP_Custom_Checkbox_Label(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment