• Need to override the FC page, to hide some redundant zeroes with JQ. The code below works fine in the cart page, but with FC it doesn’t work as expected, as the needed elements get overridden back to default values, after ajax finishes loading the gateways.

    function hide_zero_item() {
    	$('tr.cart_item').each( function() {
    		if( ewjs.is_zero( $(this).find('span.amount bdi') ) ) {
    			$(this).find('span.amount bdi').empty();
    			$(this).find('.product-quantity').hide();
    		}
    	});
    } hide_zero_item();

    I’ve workarounded the idiosyncratic behavior with a timer, but that’s an ugly and unreliable hack:

    // FC workaround: give some time for stuff to load pass the overrides
    var existCondition = setInterval( function() {
    	let $obj = $('body.woocommerce-checkout tr.cart_item');
    	if( $obj.length ) {
    		clearInterval(existCondition);
    		hide_zero_item();
    	}
    }, 3000 ); // ms

    Would you please hint how’s/where’s the proper way of doing the wanted override in FC?

    Thank you very much in advance.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘doing some js override in FC’ is closed to new replies.