Support » Plugin: WooCommerce » Deactivation creates fatal error

  • Resolved misscatherine

    (@misscatherine)



    Hello,

    I had intended on creating a web-shop on my site using Woo-commerce plugin. I went through most of the process, took a lot of time to select all the right settings for my needs, create a first test product, etc. I even installed the WPML-woocommerce plugin to translate everything.

    But for different reasons, I’ve finally decided to backtrack and NOT publish the web-shop. At least not for the time being.

    I’d like to deactivate Woo-commerce.

    BUT, I don’t want to complete delete it in case I wish to give it another try in the future. I want to avoid having to go though the entire set-up process again…

    I tried simply deactivating the plugin and the translation plugin from my extensions panel. But this creates a fatal error on my blog page!! A red fatal error line appears instead of my blog page content!!

    Can you please advise me on a way I could deactivate the plugins without completely loosing my settings and without affecting my website?

    Thanks in advance,
    Catherine

Viewing 7 replies - 1 through 7 (of 7 total)
  • Here’s a screen shot of the fatal error message that appears instead of my blog posts :

    Screen-shot fatal error message

    The easiest way would be to open the functions.php file from your child theme (the path is displayed in the error message) and comment out the relevant line (19) or lines (if there’s more code referencing WooCommerce). Without seeing the functions.php file it’s difficult to say what exactly needs to be commented out*. By doing this you can then uncomment out the relevant lines if you ever want to reactivate WooCommerce.

    *To comment out use double forward slashes // at the beginning of every line that you don’t want to be processed (or /** PHP code **/ for larger sections of code). There’s a good blogpost about such things here.

    • This reply was modified 1 year, 4 months ago by  purbeckpixels.

    Thanks for taking the time to reply purbeckpixels.

    However, I’m still stumped.

    Line 19 of my child theme functions.php file has nothing to do with Woocommerce. It’s important styling code for my English & French blog headers.

    Here what lines 16 to 25 look like:

    // Hides Header but displays Topbar
    // on Single & FR Blogue page & EN Blog page.
    function hide_header_single_posts() {
      if ( (is_single() && !is_product()) || is_page (649) || is_page (2177) ) { // Custom header for posts
        add_filter( 'fl_fixed_header_enabled', '__return_false' );
        add_filter( 'fl_header_enabled', '__return_false' );
        get_header();
      }
    }
    add_action( 'fl_body_open', 'hide_header_single_posts' );

    I really, really don’t think commenting out any of these lines is a good idea. This code was all created way before I even installed Woocommerce plugin.

    Any other ideas anyone??

    Try this:

    // Hides Header but displays Topbar
    // on Single & FR Blogue page & EN Blog page.
    function hide_header_single_posts() {
      if ( (is_single() /* && !is_product()) */ || is_page (649) || is_page (2177) ) { // Custom header for posts
        add_filter( 'fl_fixed_header_enabled', '__return_false' );
        add_filter( 'fl_header_enabled', '__return_false' );
        get_header();
      }
    }
    add_action( 'fl_body_open', 'hide_header_single_posts' );

    Oops… don’t try that, try this:

    // Hides Header but displays Topbar
    // on Single & FR Blogue page & EN Blog page.
    function hide_header_single_posts() {
      if ( /* ( */ is_single() /* && !is_product()) */ || is_page (649) || is_page (2177) ) { // Custom header for posts
        add_filter( 'fl_fixed_header_enabled', '__return_false' );
        add_filter( 'fl_header_enabled', '__return_false' );
        get_header();
      }
    }
    add_action( 'fl_body_open', 'hide_header_single_posts' );

    Thank you again Purb.

    Your code didn’t work but you did put a tech from my theme support team on the right trac.

    The solution consisted in changing the function calls is_product() to is_singular(‘product’) under LINES 19 and 31 of functions.php

    I have been able to deactivate WooCommerce and WooCommerce multilingual without creating a fatal error. 🙂

    Forums like these are really awesome! Thank you again!

    You’re welcome. Like I said, without seeing the complete functions.php file it was difficult to narrow down. It’s good that the theme author fixed it properly – commenting out all references to WooCommerce variables would’ve been just a quick fix, certainly not the best/correct way to do it.

    I agree, these forums are a brilliant resource.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Deactivation creates fatal error’ is closed to new replies.