• woo-pelecard-gateway/includes/Plugin.php

    Original (broken, triggers redirect in Elementor when editing the page):

    	public function frame_buster_snippet() {
    // Honor merchant opt-out via gateway setting.
    $gateway = Gateway::instance();
    if ( 'yes' !== $gateway->get_option( 'frame_buster', 'yes' ) ) {
    return;
    }

    // Limit scope to checkout-related pages so non-payment iframes on the
    // site (e.g. embeds inside product descriptions) are untouched.
    if ( ! function_exists( 'is_checkout' ) ) {
    return;
    }

    $relevant = is_checkout()
    || is_cart()
    || is_wc_endpoint_url( 'order-received' )
    || is_wc_endpoint_url( 'order-pay' )
    || is_add_payment_method_page();

    if ( ! $relevant ) {
    return;
    }

    ?>
    <script>
    (function () {
    try {
    if ( window.top !== window.self
    && window.top.location.hostname === window.location.hostname ) {
    window.top.location.href = window.location.href;
    }
    } catch ( e ) {}
    })();
    </script>
    <?php
    }

    Fixed (added check for Elementor):

    public function frame_buster_snippet() {
        // Honor merchant opt-out via gateway setting.
        $gateway = Gateway::instance();
        if ( 'yes' !== $gateway->get_option( 'frame_buster', 'yes' ) ) {
            return;
        }
    
        // Limit scope to checkout-related pages so non-payment iframes on the
        // site (e.g. embeds inside product descriptions) are untouched.
        if ( ! function_exists( 'is_checkout' ) ) {
            return;
        }
    
        $relevant = is_checkout()
            || is_cart()
            || is_wc_endpoint_url( 'order-received' )
            || is_wc_endpoint_url( 'order-pay' )
            || is_add_payment_method_page();
    
        if ( ! $relevant ) {
            return;
        }
    
        if(!(class_exists('\Elementor\Plugin') && (\Elementor\Plugin::$instance->editor->is_edit_mode() || \Elementor\Plugin::$instance->preview->is_preview_mode()))) {
        ?>
        <script>
        (function () {
            try {
                if ( window.top !== window.self
                    && window.top.location.hostname === window.location.hostname ) {
                    window.top.location.href = window.location.href;
                }
            } catch ( e ) {}
        })();
        </script>
        <?php
        }
    }

    This fixed the problem for us, but not sure if it other page builders might have same problem.

You must be logged in to reply to this topic.