disable woocommerce “sameorigin” header – remove_action not working?

Question

I need to embed a wc checkout page, but I can’t because of this: (in wp-content/plugins/woocommerce/includes/wc-template-functions.php)

/**
 * When loading sensitive checkout or account pages, send a HTTP header to limit rendering of pages to same origin iframes for security reasons.
 *
 * Can be disabled with: remove_action( 'template_redirect', 'wc_send_frame_options_header' );
 *
 * @since  2.3.10
 */
function wc_send_frame_options_header() {

    if ( ( is_checkout() || is_account_page() ) && ! is_customize_preview() ) {
        send_frame_options_header();
    }
}
add_action( 'template_redirect', 'wc_send_frame_options_header' );

I’m not a wp developer, but I did as they say in the phpdoc, I tried to add:

remove_action( 'template_redirect', 'wc_send_frame_options_header' );

in the function.php of the theme, but nothing changed, the header is still present.

I also tried with a simple plugin:

<?php

class RemoveWcFrame {
    public function __construct()
    {
        remove_action( 'template_redirect', 'wc_send_frame_options_header' );
    }
}

But nothing changed… What am I doing wrong?

0
the_nuts 4 months 2020-12-24T13:10:42-05:00 0 Answers 5 views 0

Leave an answer

Browse
Browse