0

I disabled all styles and scripts for certain pages using the following code:

remove_action( 'wp_enqueue_scripts', [ WC_Frontend_Scripts::class, 'load_scripts' ] );
remove_action( 'wp_print_scripts', [ WC_Frontend_Scripts::class, 'localize_printed_scripts' ], 5 );
remove_action( 'wp_print_footer_scripts', [ WC_Frontend_Scripts::class, 'localize_printed_scripts' ], 5 );

As the question implies, the only thing, which has now disappeared, I want to keep working is the XHR AJAX calls to wc-ajax=get_refreshed_fragments. Is there any way to do this?

closed as off-topic by Jacob Peattie, Nathan Johnson, Howdy_McGee Feb 11 at 16:49

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

1

If you look how that script is loaded in WC core

    'wc-cart-fragments'          => array(
        'src'     => self::get_asset_url( 'assets/js/frontend/cart-fragments' . $suffix . '.js' ),
        'deps'    => array( 'jquery', 'js-cookie' ),
        'version' => WC_VERSION,
    ),

You'll see the path to that script, as well as it's dependencies. rebuild that path and enqueue it yourself. FYI $suffix is set like this:

$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';

Not the answer you're looking for? Browse other questions tagged or ask your own question.