最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

How it it possible to disbale all WooCommerce scripts and styles, but keep wc-ajax=get_refreshed_fragments working?

matteradmin9PV0评论
Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 6 years ago.

Improve this question

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. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 6 years ago.

Improve this question

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?

Share Improve this question asked Feb 7, 2019 at 13:45 manifestormanifestor 3136 silver badges15 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 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';
Post a comment

comment list (0)

  1. No comments so far