Disable default WooCommerce stylesheets

WooCommerce enqueues 3 stylesheets by default. You can disable them all, or selectively remove some, with the following snippets. This is the recommended process if you’re building a custom theme. Removing the default WooCommerce stylesheet and enqueuing your own will protect you during WooCommerce core updates.

		/**
 * Disable default WooCommerce style sheets
 */

// Disables all three default stylesheets, or selectively disables some
// https://docs.woocommerce.com/document/disable-the-default-stylesheet/

// Disable all
add_filter('woocommerce_enqueue_styles', '__return_empty_array');

// Choose which stylesheets to disable
add_filter('woocommerce_enqueue_styles', 'sc_woo_dequeue_styles');

function sc_woo_dequeue_styles($enqueue_styles) {
  unset($enqueue_styles['woocommerce-general']);  // Remove the gloss
  unset($enqueue_styles['woocommerce-layout']);  // Remove the layout
  unset($enqueue_styles['woocommerce-smallscreen']);  // Remove the smallscreen optimisation
  return $enqueue_styles;
}

// Then enqueue your own stylesheet
add_action('wp_enqueue_scripts', 'sc_woo_enqueue_my_style');

function sc_woo_enqueue_my_style(){
  wp_register_style('mytheme-woocommerce', get_template_directory_uri() . '/css/woocommerce.css');

  if ( class_exists('woocommerce')) {
    wp_enqueue_style('mytheme-woocommerce');
  }
}
	
View Raw Code ID: 91390