Maximum blog is helpful information
for web design and worpdress development.
Explore all our post.
Maximum blog is helpful information
for web design and worpdress development.
Explore all our post.

How Exclude some WooCommerce Styles And Scripts?

Woocommerce connects many of your own scripts and styles.
Sometimes it interferes with and does not need you. About the same as disable unnecessary styles or scratches?

	function max_action_clean_woo_head() {
		
		if ( class_exists( 'WooCommerce' ) ) {
			
			if ( function_exists( 'is_woocommerce' ) ) {
				//dequeue scripts and styles
			
					wp_dequeue_style( 'woocommerce_frontend_styles' );
					wp_dequeue_style( 'woocommerce-general');
					wp_dequeue_style( 'woocommerce-layout' );
					wp_dequeue_style( 'woocommerce-smallscreen' );
					wp_dequeue_style( 'woocommerce_fancybox_styles' );
					wp_dequeue_style( 'woocommerce_chosen_styles' );
					wp_dequeue_style( 'woocommerce_prettyPhoto_css' );
					wp_dequeue_style( 'select2' );
					wp_dequeue_script( 'wc-add-payment-method' );
					wp_dequeue_script( 'wc-lost-password' );
					wp_dequeue_script( 'wc_price_slider' );
					wp_dequeue_script( 'wc-single-product' );
					wp_dequeue_script( 'wc-credit-card-form' );
					wp_dequeue_script( 'wc-checkout' );
					wp_dequeue_script( 'wc-add-to-cart-variation' );
					wp_dequeue_script( 'wc-single-product' );
					wp_dequeue_script( 'wc-cart' );
					wp_dequeue_script( 'wc-chosen' );
					wp_dequeue_script( 'woocommerce' );
					wp_dequeue_script( 'prettyPhoto' );
					wp_dequeue_script( 'prettyPhoto-init' );
					wp_dequeue_script( 'jquery-blockui' );
					wp_dequeue_script( 'jquery-placeholder' );
					wp_dequeue_script( 'jquery-payment' );
					wp_dequeue_script( 'fancybox' );
					wp_dequeue_script( 'jqueryui' );
			
			}
		}
	}
	add_action( 'wp_enqueue_scripts', 'max_action_clean_woo_head' );

This is a simple example of how to disable unnecessary styles and scripts from WooCommerce. The scripts and css that I exclude in my themes.

Leave a comment