WordPress
2
Вклад в тег
add_filter('woocommerce_order_button_html', 'custom_order_button_text' );
function custom_order_button_text( $button_shop ) {
$default = __( 'Place order', 'woocommerce' ); // If needed
$chosen_payment_method = WC()->session->get('chosen_payment_method');
if( $chosen_payment_method == 'alg_custom_gateway_1'){
$button_shop = '<button type="submit">Ваша кнопка с нужными значениями и классами</button>';
}
// jQuery code: Make dynamic text button "on change" event ?>
<script type="text/javascript">
(function($){
$('form.checkout').on( 'change', 'input[name^="payment_method"]', function() {
var t = { updateTimer: !1, dirtyInput: !1,
reset_update_checkout_timer: function() {
clearTimeout(t.updateTimer)
}, trigger_update_checkout: function() {
t.reset_update_checkout_timer(), t.dirtyInput = !1,
$(document.body).trigger("update_checkout")
}
};
t.trigger_update_checkout();
});
})(jQuery);
</script><?php
return $button_shop;
}