• Resolved calebyourneighborhub

    (@calebyourneighborhub)


    I have a website, and when I go to the WordPress admin page and click on woocommerce-settings it shows this error:

    Fatal error: Cannot declare class WC_Settings_General, because the name is already in use in /(hosting)/website/wp-content/plugins/woocommerce/includes/admin/settings/class-wc-settings-general.php on line 0 The site is experiencing technical difficulties. Please check your site admin email inbox for instructions.

    The beginning of class-wc-settings-general.php looks like this:

    <?php
    /**
     * WooCommerce General Settings
     *
     * @package WooCommerce/Admin
     */
    
    defined( 'ABSPATH' ) || exit;
    
    if ( class_exists( 'WC_Settings_General', false ) ) {
        return new WC_Settings_General();
    }
    
    /**
     * WC_Admin_Settings_General.
     */
    class WC_Settings_General extends WC_Settings_Page {
    
        /**
         * Constructor.
         */
        public function __construct() {
            $this->id    = 'general';
            $this->label = __( 'General', 'woocommerce' );
    
            parent::__construct();
        }
    
        /**
         * Get settings array.
         *
         * @return array
         */
        public function get_settings() { 

    etc. The webpage url that is generating this error is: https://www.(mywebsite).com/wp-admin/admin.php?page=wc-settings

    I need to know how to resolve this issue and get to the woocommerce settings. I have other websites that have woocommerce and do not have this issue, and I do not know where the other place it is declared would be.

    If you need to know the list of plugins, please, let me know.

    Please do not flag as a duplicate post as this is a very specific issue regarding woocommerce and WordPress that the other posts I have looked at (around 8 others) do not fix. I have checked for require to change to require_once

    Thank you in advance!

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Was this resolved? It seems very like my error!
    Thanks

    Thread Starter calebyourneighborhub

    (@calebyourneighborhub)

    It has not been completely resolved. Do you have a plugin that makes prices un-viewable until a user is signed in? I think it’s called Hide Price Until Login (Modified).

    I have narrowed it down to that particular plugin, although I do not know what is causing the plugin to produce the error.

    Let me know if you have the plugin, as we might be able to figure it out yet.

    Yes, it is: ‘Hide Price Until Login’ that takes down my Settings. Tracked it down today.

    Thread Starter calebyourneighborhub

    (@calebyourneighborhub)

    Interesting. Do you know if there is a file that tries to call the Woocommerce settings at the same time as woocommerce? It looks like there are two calls going on for the settings from what I can tell.

    There are!
    Error Details
    =============
    An error of type E_COMPILE_ERROR was caused in line 0 of the file /var/www/vhosts/abc.co.uk/httpdocs/zxz/wp-content/plugins/woocommerce/includes/admin/settings/class-wc-settings-general.php. Error message: Cannot declare class WC_Settings_General, because the name is already in use

    I was testing with “Helios Solutions WooCommerce Hide Price and Add to Cart button”
    Jenny

    Thread Starter calebyourneighborhub

    (@calebyourneighborhub)

    So I guess the call for the settings should just come from one place. I might try and removing the errors from the class-wc-settings-general.php or just temporarily deleting it. It might work then.

    Unless we found the place where the plugin was causing the issue, then we could get rid of it there. If we found it in the plugin, then we could send a bug report to the plugin creators.

    Thread Starter calebyourneighborhub

    (@calebyourneighborhub)

    Ok, temporarily deleting it does not work

    Warning: include(settings/class-wc-settings-general.php): failed to open stream: No such file or directory in /home/jenkuzni/public_html/keywebsite/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-settings.php on line 50
    
    Warning: include(): Failed opening 'settings/class-wc-settings-general.php' for inclusion (include_path='.:/usr/local/php70/pear') in /home/jenkuzni/public_html/keywebsite/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-settings.php on line 50
    
    Warning: include(settings/class-wc-settings-general.php): failed to open stream: No such file or directory in /home/jenkuzni/public_html/keywebsite/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-settings.php on line 50
    
    Warning: include(): Failed opening 'settings/class-wc-settings-general.php' for inclusion (include_path='.:/usr/local/php70/pear') in /home/jenkuzni/public_html/keywebsite/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-settings.php on line 50
    
    Fatal error: Cannot declare class WC_Settings_Products, because the name is already in use in /home/jenkuzni/public_html/keywebsite/wp-content/plugins/woocommerce/includes/admin/settings/class-wc-settings-products.php on line 0
    The site is experiencing technical difficulties. Please check your site admin email inbox for instructions.
    Thread Starter calebyourneighborhub

    (@calebyourneighborhub)

    Ok, I have found a way around the problem: Go to

    /yourwebsite/wp-content/plugins/hide-price-until-login-modified/includes/hide-price-until-login-class.php

    and on line 512 there is a call that looks like this:

    add_filter( ‘woocommerce_get_settings_pages’, ‘hide_price_until_login_plugin_setting_class_initiate’ );

    Comment it out and see if it fixes your problem. For me, it does not include the settings tab for the plugin in the Woocommerce settings, but it allows access to the Woocommerce settings at least.

    Plugin Support AW a11n

    (@slash1andy)

    Automattic Happiness Engineer

    Hey there!

    Since this is a few weeks old, and not specifically a WooCommerce issue, I am going to mark as resolved. A lot of people have found help in the Advanced WooCommerce group with things like this, so I would recommend checking there, or we highly recommend contacting one of the services on our Customizations page (https://woocommerce.com/customizations/)

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Fatal error: Cannot declare class MYCLASS Woocommerce Settings’ is closed to new replies.