Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter Hooks to adjust checkout field labels..?? #898

Closed
angelleye opened this issue Oct 11, 2017 · 4 comments
Closed

Filter Hooks to adjust checkout field labels..?? #898

angelleye opened this issue Oct 11, 2017 · 4 comments

Comments

@angelleye
Copy link
Collaborator

If I wanted to change the titles/labels of the fields (Expiry to Expiration Date, etc) in the Braintree CC processing part of the plugin, what would be the best way to do that without modifying the plugin itself?

Need to look into adding filter hooks for all of our gateways so that people can adjust the field labels if they want to.

@kcppdevelopers
Copy link
Contributor

@angelleye In Braintree CC UI, we have used Woo default CC UI. there is no any hook/filter available to change fields name.

@kcppdevelopers
Copy link
Contributor

cc_form

@angelleye
Copy link
Collaborator Author

@kcppdevelopers As discussed in Slack it seems we're actually not using the built in Woo forms, so we can go ahead and add our own filter hooks for adjusting field labels.

@kcppdevelopers
Copy link
Contributor

add_filter('cc_form_label_card_number', 'own_cc_form_label_card_code', 10, 2);
add_filter('cc_form_label_card_code', 'own_cc_form_label_card_code', 10, 2);
add_filter('cc_form_label_expiry', 'own_cc_form_label_expiry', 10, 2);

function own_cc_form_label_card_code($lable, $gateway_id) {
// $gateway_id value like braintree, paypal_pro, paypal_advanced, paypal_credit_card_rest, paypal_pro_payflow
$lable = 'Test Card number';
return $lable;
}

function cc_form_label_card_code($lable, $gateway_id) {
// $gateway_id value like braintree, paypal_pro, paypal_advanced, paypal_credit_card_rest, paypal_pro_payflow
$lable = 'Test Card Security Code';
return $lable;
}

function own_cc_form_label_expiry($lable, $gateway_id) {
// $gateway_id value like braintree, paypal_pro, paypal_advanced, paypal_credit_card_rest, paypal_pro_payflow
$lable = 'Test Expiration Date';
return $lable;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant