Last active
December 21, 2023 11:46
-
-
Save xlplugins/1e328f1919d9501e3a39b13cd92e27e5 to your computer and use it in GitHub Desktop.
Funnelkit CHeckout compatability with HFD ePost Integration by HFD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_action( 'wfacp_internal_css', function () { | |
| if(!class_exists('\Hfd\Woocommerce\Container')){ | |
| return; | |
| } | |
| $helper = \Hfd\Woocommerce\Container::get('Hfd\Woocommerce\Helper\Spot'); | |
| ?> | |
| <script> | |
| window.addEventListener('load', function () { | |
| (function ($) { | |
| var cityLoaded = false; | |
| jQuery( "body" ).on( "updated_shipping_method wc_fragments_loaded updated_checkout", function(){ | |
| var mainBlock = jQuery('#israelpost-additional'); | |
| mainBlock.parents('.wfacp_single_shipping_method').addClass("tmp12345"); | |
| if( mainBlock.parents('.wfacp_single_shipping_method').find( 'input.shipping_method' ).is(':checked') ){ | |
| if( !cityLoaded || mainBlock.find( '#city-list' ).find( 'option' ).length == 1 ){ | |
| EpostList.init({ | |
| saveSpotInfoUrl: '<?php echo esc_html( admin_url( 'admin-ajax.php' ) ); ?>', | |
| getSpotsUrl: '<?php echo esc_html( admin_url( 'admin-ajax.php?action=get_spots' ) ); ?>', | |
| cities: <?php echo json_encode( $helper->getCities() ); ?> | |
| }); | |
| cityLoaded = true; | |
| } | |
| mainBlock.show(); | |
| setTimeout(function(){ | |
| $('#israelpost-additional select').select2(); | |
| },200); | |
| }else{ | |
| mainBlock.hide(); | |
| } | |
| }); | |
| })(jQuery); | |
| }); | |
| </script> | |
| <?php | |
| } ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment