-
Notifications
You must be signed in to change notification settings - Fork 14
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
Regarding cutom fields in gateways #351
Comments
We have the same going on with some of our own fields. Please see how we've resolved that in https://github.com/pronamic/wp-pronamic-pay-woocommerce/blob/c46f2a96aeb4c48afc91823dc34ea8a0a6f15ab9/src/Gateway.php#L958-L994 Does that answer your question? |
Thanks, will try that and let you know if more help needed. |
Hello @rvdsteege, The solution below is not fully working for me.
In this method, there is a challenge. For each custom field in the payment method of the gateway, we will have to define it in each extension, if we want to show that field for that extension or not. It will create lots of combinations and will make coding difficult. For example, I am writing code for a custom gateway, where a phone number is mandatory. So I write below code in my gateway constructor
This phone field should be displayed on the configuration page for testing, but should not be displayed on WooCommerce checkout, because WooCommerce already has a pre-defined phone field on its checkout. So, we don't want to confuse customers by showing the phone field twice. Now if I write the code to hide phone for this gateway in woocommerce, It will work only for this gateway. If I have 50 such custom fields in different gateways, we will have to write code for the custom fields in all the extensions. Proposed Solution: We should tell Gateway, what all pre-defined fields we have in this extension In woocommerce, we have pre-defined fields like (customer_firstname, customer_lastname, customer_phone, customer_address etc). After telling gateway that we already have these pre-defined fields, then we should ask gateway if gateway wants to show any other fields apart from pre-defined fields. We can also tell the gateway name of the extension (eg woocommerce), so that gateway can return more personalized results. @rvdsteege and @remcotolsma what is your opinion on the same? Was I able to explain my concern properly? or you need more clarity? |
That is indeed a challenge, how do we know which input is provided by plugins such as WooCommerce, Easy Digital Download, Gravity Forms, Contact Form 7, etc. etc.. A WooCommerce telephone number field can also be disabled/removed. And these fields may or may not be mandatory. We do have some specific code in the WooCommerce library for Pronamic Pay for filtering date of birth and gender fields: https://github.com/pronamic/wp-pronamic-pay-woocommerce/blob/1af5496b74b23aacc4f48f00f943dda4cfb90c93/src/Gateway.php#L991-L1027. This is not yet very nice, so there is certainly room for improvement. I don't know what the best approach is, I suggest opening a new issue for this. |
Hello Team
In #154 , you have introduced a way using which we can create custom fields that are required for certain payment methods for a gateway. I have a query regarding the same. There are certain fields for example "Phone Number". Some payment gateway needs a customer phone number field. Some WordPress plugins like Woocommerce by default ask for customer phone number, so this can easily be passed to gateway. But some plugins like EDD, Give etc don't ask for customer phone number by default. If we will create a custom phone number field for that particular payment method/provider, it will ask for phone number again on Woocommerce also. It's not good to ask phone number again when customer has already entered it while filling the checkout form. Where as for EDD and Give, customer needs to enter phone number because this field is missing in these plugins.
Kindly suggest how to proceed with this.
The text was updated successfully, but these errors were encountered: