-2

Why file plugins/woocommerce/assets/css/woocommerce.css for my template can not be read?

Please look this image :

enter image description here

4
  • If for some reason ur theme can't read woocommerce.css Then try to manually call that file like <link href="<?php bloginfo('template_directory')?>/../../plugins/woocommerce/assets/css/woocommerce.css" rel="stylesheet">. And if u r using child them then use bloginfo('stylesheet_directory') instead of bloginfo('template_directory') to call woocommerce.css.
    – Rishabh
    Jul 4, 2016 at 11:20
  • thank you , but is not loading again :/
    – amirali
    Jul 4, 2016 at 12:14
  • Questions specific to WooCommerce are off-topic here, and are better asked about at WooCommerce's own forum.
    – Tim Malone
    Jul 5, 2016 at 7:51
  • @Tim Malone May be the question is related to wordpress only! He is asking why my wordpress is not picking a css file. And that file is css file or any other file, And that file is in plugin folder or in theme folder or where ever! does that matter!?
    – Rishabh
    Jul 5, 2016 at 8:07

3 Answers 3

1
function woocommmerce_style() {
   wp_enqueue_style('woocommerce_stylesheet', WP_PLUGIN_URL. '/woocommerce/assets/css/woocommerce.css',false,'1.0',"all");
}
add_action( 'wp_head', 'woocommmerce_style' );

paste the above code in your "functions.php". woocommerce stylesheet will be executed to your site

1
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – fuxia
    Jul 5, 2016 at 10:03
0

I had this problem, I added "woocommerce woocommerce-page" classes to body, or parents of woocommerce loop, so it solved the problem,

actually, woocommerce main classes are not add to page.

0

As @ali-h correctly points out, the missing body classes are the culprit here...

You can solve this by using the corresponding filter body_class and add your own classes, in this case the WooCommerce-specific ones:

/**
 * Add <body> classes
 */
add_filter('body_class', function (array $classes) {
  /** Add WC classes if on a custom template or when viewing search results */
  if (is_page_template('directory-name/page-something.php') || is_search()) {
    $classes[] = 'woocommerce woocommerce-page';
  }

  return array_filter($classes);
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.