Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save xlplugins/d61156d113cc8af981874b9642af9be2 to your computer and use it in GitHub Desktop.
Save xlplugins/d61156d113cc8af981874b9642af9be2 to your computer and use it in GitHub Desktop.
Add Fake Element on funnelkit checkout - WooReward plugin
class WFACP_Cart_FAKE_Element {
public function __construct() {
add_action( 'wfacp_outside_header', [ $this, 'action' ] );
add_action( 'wfacp_internal_css', [ $this, 'internal_js' ] );
}
public function is_enable() {
$is_global_checkout = WFACP_Core()->public->is_checkout_override();
if ( true === $is_global_checkout ) {
return false;
}
return true;
}
public function action() {
if ( $this->is_enable() == false ) {
return;
}
?>
<div class="woocommerce-cart-form">
<button type="submit" class="button" name="update_cart" value="עדכן עגלה" disabled="">עדכן עגלה</button>
</div>
<?php
}
public function internal_js() {
if ( $this->is_enable() == false ) {
return;
}
?>
<script>
window.addEventListener('bwf_checkout_js_load', function () {
(function ($) {
$('.woocommerce-cart-form button').on('click', function () {
$(document.body).trigger('update_checkout');
});
})(jQuery);
})
</script>
<?php
}
}
new WFACP_Cart_FAKE_Element();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment