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

Update Gateway.php #7

Closed
wants to merge 1 commit into from
Closed

Update Gateway.php #7

wants to merge 1 commit into from

Conversation

knit-pay
Copy link
Contributor

Instead of showing "Pronamic" on the payment button as default text, it should be fetched from the user-defined title. So that the admin can edit the payment button text. What do you think about it?

Instead of showing "Pronamic" on the payment button as default text, it should be fetched from the user-defined title. So that the admin can edit the payment button text. What do you think about it?
@rvdsteege
Copy link
Member

Instead of showing "Pronamic" on the payment button as default text [...]

I don't think it ever does (I was unable to reproduce it), there's a null !== $this->payment_method check around setting the order button text. The payment_method property of the 'Pronamic method' is null, which results in the order button text not being set. The default WooCommerce Place order button text will then be used.

[...] it should be fetched from the user-defined title. So that the admin can edit the payment button text.

The payment method title is not the same as the order button text. We currently set the button text to Proceed to {payment method name} if the name of the payment method is known (which is the case for all methods, except for the unique Pronamic method). Consider the title being set to for example Method X (no additional fees!), we don't want to set the button text to a title like this, as it is unclear what the button will do if we only use the title as button text and prepending the button text will result in text like "Proceed to Method X (no additional fees!)" — which is also a little strange.

We've actually used the title as button text in the past, but have moved away from that as we noticed all kinds of weird texts on this button.

Please note that the filter woocommerce_order_button_text can also be used to set the order button text.

@rvdsteege rvdsteege closed this Sep 2, 2021
@knit-pay
Copy link
Contributor Author

knit-pay commented Sep 3, 2021

I understand what you say. Are you planning to give an option to the admin to edit button text without woocommerce_order_button_text filter? I mean, currently, the admin has an option to edit the title, are you planning to give a new option to change button text also?

@rvdsteege
Copy link
Member

No plans for an order button text option. Such option might result in i18n issues, for example if the user profile language not equals the site language.

Do you have a specific use case, where Place order does not make sense for the order button?

@knit-pay
Copy link
Contributor Author

knit-pay commented Sep 4, 2021

For custom payment methods, currently, there is no way to define the payment method name. Kindly refer
pronamic/wp-pay-core#51

For these custom payment methods, woocommerce shows "Proceed to Pronamic". Kindly assist, how can we handle this?

@rvdsteege
Copy link
Member

What exactly is a custom payment method? If this is a class extending from WC_Payment_Gateway (or the Pronamic Pay Pronamic\WordPress\Pay\Extensions\WooCommerce\Gateway class), you can just set $this->order_button_text property in your constructor.

@knit-pay
Copy link
Contributor Author

Hello @rvdsteege

Sorry for the late reply. I missed your last message.
Actually, in India, we have a payment method called UPI. So, to add the support of UPI in woocommerce, I added below code here
https://github.com/wp-pay-extensions/woocommerce/blob/f8c2830216af9dff695e6939dca5e8b769d4703d/src/Extension.php#L160

array(
	'id'           => 'pronamic_pay_upi',
	'payment_method' => 'upi',
	'method_title' => 'UPI',
)

Now, on woocommerce checkout page, I see "Proceed to Pronamic", instead of "Proceed to UPI" because of PaymentMethods::get_name function, which makes customers confuse.
https://github.com/wp-pay-extensions/woocommerce/blob/f8c2830216af9dff695e6939dca5e8b769d4703d/src/Gateway.php#L141

That's why I requested filters here. Could you please work on adding this filter? It will fix the issue I mentioned above.
pronamic/wp-pay-core#51

Because get_payment_methods function does not have the name of upi payment method, woocommerce checkout page is showing "Proceed to Pronamic"

Also, kindly add a filter here also
https://github.com/wp-pay-extensions/woocommerce/blob/f8c2830216af9dff695e6939dca5e8b769d4703d/src/Extension.php#L160

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

Successfully merging this pull request may close these issues.

2 participants