• Resolved tomhndrx

    (@tomhndrx)


    I don’t know what happened, but suddenly my shop overview page displays a critical error. Product detail pages still work, but the overview seems to be broken.

    UPDATE:
    Apparently the issue was caused by the Gutentor plugin. I can’t disable it, because my theme heavily uses it.

    I narrowed the issue to a part of the code and just disabled that part. Everything *seems* to be fine now. But i have no idea what i disabled…

    This is the piece of code i disabled:

    * Modify cart html if gutentor-attributes set
    *
    * @static
    * @access public
    * @since 2.1.9
    * @return string
    */
    //public function alter_cart_link( $output, $product, $args ) {
    // $attributes = isset( $args[‘gutentor-attributes’] ) ? $args[‘gutentor-attributes’] : false;
    // if ( ! $attributes ) {
    // return $output;
    // }
    // $icon = ”;
    // $btnClass = isset( $attributes[‘pBtnCName’] ) ? $attributes[‘pBtnCName’] : ”;
    // $default_class = gutentor_concat_space( ‘gutentor-button’, ‘gutentor-post-button’, $btnClass );
    // $woo_class = esc_attr( isset( $args[‘class’] ) ? $args[‘class’] : ‘button’ );
    // $icon_options = ( isset( $attributes[‘pBtnIconOpt’] ) ) ? $attributes[‘pBtnIconOpt’] : ”;
    // $icon_post_options = isset( $icon_options[‘position’] ) ? $icon_options[‘position’] : ”;
    // if ( $icon_post_options == ‘before’ || $icon_post_options == ‘after’ ) {
    // $icon = ( isset( $attributes[‘pBtnIcon’] ) && $attributes[‘pBtnIcon’][‘value’] ) ? ‘<i class=”gutentor-button-icon ‘ . $attributes[‘pBtnIcon’][‘value’] . ‘” ></i>’ : ‘<i class=”gutentor-button-icon fas fa-book” ></i>’;
    // }
    // $output = ‘add_to_cart_url() ) . ‘” data-quantity=”‘ . esc_attr( isset( $args[‘quantity’] ) ? $args[‘quantity’] : 1 ) . ‘”
    // class=”‘ . gutentor_concat_space( $default_class, $woo_class, GutentorButtonOptionsClasses( $icon_options ) ) . ‘” ‘ . ( isset( $args[‘attributes’] ) ? wc_implode_html_attributes( $args[‘attributes’] ) : ” ) . ‘>
    // ‘ . $icon . ‘<span>’ . esc_html( $product->add_to_cart_text() ) . ‘</span>‘;
    // return $output;

    //}

    This is the error message in the Woocommerce log:

    2020-12-29T00:49:38+00:00 CRITICAL Uncaught ArgumentCountError: Too few arguments to function Gutentor_Extend_Api::alter_cart_link(), 2 passed in /wordpress/core/5.6/wp-includes/class-wp-hook.php on line 287 and exactly 3 expected in /srv/htdocs/wp-content/plugins/gutentor/includes/tools/class-gutentor-extend-api.php:266
    Stack trace:
    #0 /wordpress/core/5.6/wp-includes/class-wp-hook.php(287): Gutentor_Extend_Api->alter_cart_link(‘<a rel=”nofollo…’, Object(WC_Product_Simple))
    #1 /wordpress/core/5.6/wp-includes/plugin.php(212): WP_Hook->apply_filters(‘<a rel=”nofollo…’, Array)
    #2 /srv/htdocs/wp-content/themes/novo/woocommerce/content-product.php(70): apply_filters(‘woocommerce_loo…’, ‘<a rel=”nofollo…’, Object(WC_Product_Simple))
    #3 /wordpress/core/5.6/wp-includes/template.php(732): require(‘/srv/htdocs/wp-…’)
    #4 /srv/htdocs/wp-content/plugins/woocommerce/includes/wc-core-functions.php(284): load_template(‘/srv/htdocs/wp-…’, false)
    #5 /srv/htdocs/wp-content/themes/novo/woocommerce/single-product/related.php(40): wc_get_template_part(‘content’, ‘product’)
    #6 /srv/htdocs/wp-content/plugins/woocommerce/includes/wc-core-functions.php(345): include(‘/srv/htdocs/wp-…’)
    #7 /srv/htdocs/wp-content/plugins/woocommerce/includes/wc-template-functions.php(1973): wc_get_template(‘single-product/…’, Array)
    #8 /srv/htdocs/wp-content/plugins/woocommerce/includes/wc-template-functions.php(1936): woocommerce_related_products(Array)
    #9 /wordpress/core/5.6/wp-includes/class-wp-hook.php(287): woocommerce_output_related_products(”)
    #10 /wordpress/core/5.6/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array)
    #11 /wordpress/core/5.6/wp-includes/plugin.php(484): WP_Hook->do_action(Array)
    #12 /srv/htdocs/wp-content/themes/novo/woocommerce/content-single-product.php(108): do_action(‘woocommerce_aft…’)
    #13 /wordpress/core/5.6/wp-includes/template.php(732): require(‘/srv/htdocs/wp-…’)
    #14 /srv/htdocs/wp-content/plugins/woocommerce/includes/wc-core-functions.php(284): load_template(‘/srv/htdocs/wp-…’, false)
    #15 /srv/htdocs/wp-content/themes/novo/woocommerce/single-product.php(37): wc_get_template_part(‘content’, ‘single-product’)
    #16 /wordpress/core/5.6/wp-includes/template-loader.php(106): include(‘/srv/htdocs/wp-…’)
    #17 /wordpress/core/5.6/wp-blog-header.php(19): require_once(‘/wordpress/core…’)
    #18 /wordpress/core/5.6/index.php(17): require(‘/wordpress/core…’)
    #19 {main}
    thrown in /srv/htdocs/wp-content/plugins/gutentor/includes/tools/class-gutentor-extend-api.php on line 266

Viewing 1 replies (of 1 total)
  • Plugin Contributor codersantosh

    (@codersantosh)

    Hello @tomhndrx ,

    I must say that the issue is caused by Novo theme you are using.
    Here is an explanation.
    Gutentor add filter of woocommerce_loop_add_to_cart_link, which has exactly 3 parameters. And Gutentor use exactly 3 parameters on code, callback function alter_cart_link.

    The theme wrongly using woocommerce_loop_add_to_cart_link filter hook on novo\woocommerce\content-product.php line 62 only with 2 parameters. It must be 3. Please contact the theme developer and ask to change the code to meet WooCommerce standard.

    Best Regards!

Viewing 1 replies (of 1 total)
  • The topic ‘Critical error Woocommerce product overview’ is closed to new replies.