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

getSettings doesn't work #42

Closed
henriqueccruz opened this issue May 23, 2024 · 3 comments
Closed

getSettings doesn't work #42

henriqueccruz opened this issue May 23, 2024 · 3 comments

Comments

@henriqueccruz
Copy link

I've been trying to implement block-based checkout on a payment gateway which I mantain and I couldn't help noticing that even on this gateway, the getSetting function always returns false and the Payment Gateway ends up showing only because it has a fallback label defined.

As shown on #34 , the user defines the gateway name but the default keeps being used.
Also, window.wc.wcSettings.getSetting('dummy_data') always returns false on the frontend.

Is this an expected behaviour? Or am I missing something?

@henriqueccruz
Copy link
Author

For some unkown reason, /src/Blocks/BlockTypes/Checkout.php:456 was commented out on my download of Woocommerce v8.9.1
Uncommented it and all seemed to work fine.

@xristos3490
Copy link
Member

Hey @henriqueccruz!

For some unkown reason, /src/Blocks/BlockTypes/Checkout.php:456 was commented out on my download of Woocommerce v8.9.1

I double-checked whether there is an issue with the latest WooCommerce package, but these lines look as expected, so perhaps something on your end caused this. I'm glad you figured it out! :)

Nevertheless, a few details about this package:

  • Only works on frontend; other requests should always end up as false
  • It specifically uses the data provided in the get_payment_method_data under the AbstractPaymentMethodType interface.

Hope this helps!

@henriqueccruz
Copy link
Author

Besides this problem with getSettings, I had a few more issues with my gateway not showing up on the checkout.
It was related with the is_available function on the main gateway class.
These functions were proven useful for debugging:
wp.data.select('wc/store/payment').getAvailablePaymentMethods()
wp.data.select('wc/store/payment').getAvailableExpressPaymentMethods()
window.wcSettings.allSettings

Thanks for the reply nonetheless.

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

No branches or pull requests

2 participants