【发布时间】:2020-06-30 04:39:13
【问题描述】:
我正在尝试创建一个基于 javascript API 的自定义支付网关。结帐时的按钮必须像贝宝结帐按钮一样工作,这会打开另一个窗口,但我找不到替换按钮的方法。由于按钮是由javascript加载的,而html只是一个地方
add_filter( 'woocommerce_order_button_html', 'custom_order_button_html');
function custom_order_button_html( $button ) {
// The text of the button
$order_button_text = __(' order', 'woocommerce');
// HERE you make changes (Replacing the code of the button):
$button = '<div id="custom_Checkout_Button"></div>';
}
我把这个函数放在function __construct 中,但它不会替换。
脚本正在正确加载。如果我通过控制台加载脚本,它的加载很好。
【问题讨论】:
标签: wordpress woocommerce