Skip to content

Instantly share code, notes, and snippets.

@xlplugins
Created November 3, 2021 05:38
Show Gist options
  • Save xlplugins/05bb40cac6876def7e6f19607aec15b6 to your computer and use it in GitHub Desktop.
Save xlplugins/05bb40cac6876def7e6f19607aec15b6 to your computer and use it in GitHub Desktop.
Hide Address Fields On Virtual Cart
class WFACP_Hide_Address_Fields_On_Virtual_Cart {
public function __construct() {
add_action( 'wfacp_internal_css', [ $this, 'add_js' ] );
}
public function add_js() {
?>
<script>
window.addEventListener('bwf_checkout_load', function () {
(function ($) {
wfacp_frontend.hooks.addAction('wfacp_ajax_response', action_data);
// wfacp_frontend.hooks.addAction('wfacp_cart_behaviour_changed', action_data);
function action_data(action_data) {
$('.wfacp_divider_billing').parents('.wfacp-section').show();
if (true === action_data.cart_is_virtual && $('.wfacp_divider_billing').length > 0) {
$('.wfacp_divider_billing').parents('.wfacp-section').hide();
}
}
})(jQuery);
});
</script>
<?php
}
}
new WFACP_Hide_Address_Fields_On_Virtual_Cart();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment