admin管理员组文章数量:1130349
I've been trying to find an appropriate action(s) hook to do what I'm describing in my title.
Under My account > payment methods I want any newly saved payment method by the user to be set as default
I noticed the "after_woocommerce_add_payment_method" action under "add_payment_method()" function but I don't think I can simply pass a hidden input for this, especially when there is an existing default method.
"is_default" is what seems to be the identifying attribute for the default saved payment method.
I noticed that the built-in functionality for this is under class-wc-payment-tokens.php, with the function named set_users_default() so I could possibly call this provided I can hook into an action after the payment method ( Token ) has been saved ( to get the Token/method ID ) but before WC redirects to the payment-methods page.
Any ideas if I'm thinking this the right way?
I've been trying to find an appropriate action(s) hook to do what I'm describing in my title.
Under My account > payment methods I want any newly saved payment method by the user to be set as default
I noticed the "after_woocommerce_add_payment_method" action under "add_payment_method()" function but I don't think I can simply pass a hidden input for this, especially when there is an existing default method.
"is_default" is what seems to be the identifying attribute for the default saved payment method.
I noticed that the built-in functionality for this is under class-wc-payment-tokens.php, with the function named set_users_default() so I could possibly call this provided I can hook into an action after the payment method ( Token ) has been saved ( to get the Token/method ID ) but before WC redirects to the payment-methods page.
Any ideas if I'm thinking this the right way?
本文标签: Automatically making a newly saved payment method default in WooCommerce
版权声明:本文标题:Automatically making a newly saved payment method default in WooCommerce 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749196472a2331062.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论