Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save xlplugins/b4df929687d834fba84ac1a2c9059ac7 to your computer and use it in GitHub Desktop.
Save xlplugins/b4df929687d834fba84ac1a2c9059ac7 to your computer and use it in GitHub Desktop.
trigger submit button by custom buttom
if ( ! class_exists( 'Custom_place_order_button_Count' ) ) {
class Custom_place_order_button_Count {
private static $instance = null;
public static function get_instance() {
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
private function __construct() {
add_action( 'wfacp_internal_css', [ $this, 'css_js' ] );
}
public function css_js() {
?>
<style>
#place_order {
display: none;
}
</style>
<script>
window.addEventListener('bwf_checkout_js_load', function () {
(function ($) {
$('#custom_button_id').on('click', function (e) {
e.preventDefault();
$('#place_order').trigger('click');
});
})(jQuery);
});
</script>
<?php
}
}
Custom_place_order_button_Count::get_instance();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment