Support » Plugin: Mailchimp for WooCommerce » Error thrown at login

  • Resolved tbaldwin2020

    (@tbaldwin2020)


    Hello. I just tried to install/activate this plugin.

    However, I now have the following error.

    Call to undefined method Automattic\WooCommerce\Admin\Notes\WC_Admin_Note::set_layout()

    I cannot get in to the admin dashboard. Any suggestions?
    Thanks.

Viewing 15 replies - 1 through 15 (of 15 total)
  • Same here, the plugin essentially breaks the WP admin area. The full stacktrace is:

    [23-Sep-2020 05:59:53 UTC] PHP Fatal error:  Uncaught Error: Call to undefined method Automattic\WooCommerce\Admin\Notes\WC_Admin_Note::set_layout() in /var/www/vhosts/…/staging.…/wp-content/plugins/mailchimp-for-woocommerce/admin/class-mailchimp-woocommerce-admin.php:312
    Stack trace:
    #0 /var/www/vhosts/…/staging.…/wp-includes/class-wp-hook.php(287): MailChimp_WooCommerce_Admin->initial_notice('')
    #1 /var/www/vhosts/…/staging.…/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array)
    #2 /var/www/vhosts/…/staging.…/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
    #3 /var/www/vhosts/…/staging.…/wp-admin/admin-header.php(281): do_action('admin_notices')
    #4 /var/www/vhosts/…/staging.…/wp-admin/plugins.php(486): require_once('/var/www/vhosts...')
    #5 {main}
      thrown in /var/www/vhosts/…/staging.…/wp-content/plugins/mailchimp-for-woocommerce/admin/class-mailchimp-woocommerce-admin.php on line 312

    Please review that file, it looks like either a merge error or some otherwise pretty erratic code with duplications. Commenting out like below will “unblock” the WP Admin area as a workaround.

    $note = new \Automattic\WooCommerce\Admin\Notes\WC_Admin_Note();
    				$note->set_title( __( 'Mailchimp For WooCommerce', 'mailchimp-for-woocommerce' ) );
    				$note->set_content(
    					esc_html__(
    						'Plugin is not yet connected to a Mailchimp account. To complete the connection, open the settings page.',
    						'mailchimp-for-woocommerce'
    					)
    				);
    				$note->set_content_data( (object) array(
    					'getting_started'     => true,
    					'activated'           => $activated_time,
    					'activated_formatted' => $activated_time_formatted,
    				) );
    				$note->set_type( \Automattic\WooCommerce\Admin\Notes\WC_Admin_Note::E_WC_ADMIN_NOTE_WARNING );
    				// $note->set_layout('plain');
    				// $note->set_image('');
    				$note->set_name( 'mailchimp-for-woocommerce-incomplete-install' );
    				$note->set_source( 'mailchimp-for-woocommerce' );
    				// $note->set_layout('plain');
    				// $note->set_image('');
    				$note->add_action(
    					'settings',
    					__( 'Open Settings', 'mailchimp-for-woocommerce' ),
    					admin_url( 'admin.php?page=') . $this->plugin_name
    				);
    				$note->save();

    BR

    Consider me a novice at WordPress. Where would I review and make this change?

    Plugin Author ryanhungate

    (@ryanhungate)

    @kontur @tbaldwin2020 can you please confirm that you’re on version 2.4.6 as of this post response? This should be resolved as of now we’re doing a class_exists check on that area for you.

    @ryanhungate
    Yes. Version 2.4.6 is what I see. I am still seeing the error.

    • This reply was modified 2 months, 1 week ago by tbaldwin2020.

    Sorry @ryanhungate but could you please first have a look at your code in the SVN before second guessing the version reported by users. The issue I pointed to (done your work for you) is literally right there.

    @ryanhungate I just installed the latest plugin 2.4.6 and getting the same error. When the error will be fixed ?

    Plugin Author ryanhungate

    (@ryanhungate)

    @tbaldwin2020 @kontur @mrkhanakia what version of woocommerce/wordpress are you currently using? We’ll look into this further.

    @ryanhungate Woocommerce-Version 4.0.1 and WordPress 5.5.1

    Plugin Author ryanhungate

    (@ryanhungate)

    @mrkhanakia thanks – we will take a look and roll out a patch here shortly.

    Plugin Author ryanhungate

    (@ryanhungate)

    @mrkhanakia @kontur @tbaldwin2020 just applied a patch 2.4.7 which will resolve your issues. Thanks for pointing this out – we’ve tested on previous versions as you said and have been able to replicate the bug and fix it with this latest release.

    @ryanhungate will I need to reload anything in order to see the patch fix the issue? I’m currently still seeing the error thrown when I try to log in to the dashboard.

    Thanks.

    Plugin Author ryanhungate

    (@ryanhungate)

    @tbaldwin2020 unfortunately you’re in a situation where you’ll need to manually edit your plugins folder it seems. This was a fatal error which is probably preventing you from even seeing the admin pages at all.

    If you have FTP access or even file manager access in a control panel, you’ll need to delete the plugin from the wp-content/plugins folder and then you should be able to re-install things with 2.4.7 just fine.

    Looking on wpengine, I have WooCommerce version 4.0.1 and WordPress version 5.4.2, if that helps, @ryanhungate

    Plugin Author ryanhungate

    (@ryanhungate)

    @tbaldwin2020 I’m not entirely sure where you would do that with them specifically but if I remember correctly – WPEngine has a real support team which could easily help out with this issue. I’ll bet you that they can just handle that for you if you don’t have FTP or file manager access with your account.

    kontur

    (@kontur)

    just applied a patch 2.4.7 which will resolve your issues. Thanks for pointing this out – we’ve tested on previous versions as you said and have been able to replicate the bug and fix it with this latest release.

    thanks @ryanhungate can confirm working. cheers for the quick fix.

Viewing 15 replies - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.