mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-05-03 12:12:25 +08:00
https://developer.woocommerce.com/2023/06/16/best-practices-for-the-use-of-the-cart-fragments-api/
17 lines
321 B
Text
17 lines
321 B
Text
add_filter( 'woocommerce_get_script_data', function( $script_data, $handle ) {
|
|
|
|
if ( 'wc-cart-fragments' === $handle ) {
|
|
|
|
if ( is_woocommerce() || is_cart() || is_checkout() ) {
|
|
|
|
return $script_data;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return $script_data;
|
|
|
|
}, 10, 2 );
|