×

 

Home Contact Us Payments SC Commerce SC Commerce Docs SC Commerce Snippets

Simply Computing

We make websites. Simple.

Disable default SC Commerce stylesheets

SC Commerce enqueues three 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 SC Commerce stylesheet and enqueuing your own will protect you during SC Commerce core updates.

		/**
 * Disable default SC Commerce 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