• Resolved mourad

    (@m0urd)


    Hello Everyone,

    I hope to get support regarding the Critical error shown on my new website after activating the Product ratings in Woocommerce (The problem appears only in the Arabic version), after contacting WPML support they told me that the problem is from Woocommerce.

    I have made a sample video showing the issue because I can’t turn the website off or activate the option.
    Video on loom:
    https://www.loom.com/share/0de56b3af5d14beeac074f399f70896b?sid=6f12b199-44ad-407e-856f-67be817a18c6



    Error Log

    Stack trace: #0 /home/elegwlkl/seamar.ma/wp-content/plugins/woocommerce/includes/wc-template-functions.php(3653): sprintf() #1 /home/elegwlkl/seamar.ma/wp-content/plugins/woocommerce/includes/wc-template-functions.php(3634): wc_get_star_rating_html() #2 /home/elegwlkl/seamar.ma/wp-content/themes/martfury/woocommerce/single-product/rating.php(43): wc_get_rating_html() #3 /home/elegwlkl/seamar.ma/wp-content/plugins/woocommerce/includes/wc-core-functions.php(345): include(‘/home/elegwlkl/…’) #4 /home/elegwlkl/seamar.ma/wp-content/plugins/woocommerce/includes/wc-template-functions.php(1645): wc_get_template() #5 /home/elegwlkl/seamar.ma/wp-content/themes/martfury/inc/frontend/woocommerce.php(2456): woocommerce_template_single_rating() #6 /home/elegwlkl/seamar.ma/wp-content/themes/martfury/inc/frontend/woocommerce.php(2432): Martfury_WooCommerce->get_single_product_header() #7 /home/elegwlkl/seamar.ma/wp-includes/class-wp-hook.php(308): Martfury_WooCommerce->single_product_header() #8 /home/elegwlkl/seamar.ma/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters() #9 /home/elegwlkl/seamar.ma/wp-includes/plugin.php(517): WP_Hook->do_action() #10 /home/elegwlkl/seamar.ma/wp-content/themes/martfury/woocommerce/content-single-product.php(46): do_action() #11 /home/elegwlkl/seamar.ma/wp-includes/template.php(785): require(‘/home/elegwlkl/…’) #12 /home/elegwlkl/seamar.ma/wp-content/plugins/woocommerce/includes/wc-core-functions.php(284): load_template() #13 /home/elegwlkl/seamar.ma/wp-content/plugins/woocommerce/templates/single-product.php(37): wc_get_template_part() #14 /home/elegwlkl/seamar.ma/wp-includes/template-loader.php(106): include(‘/home/elegwlkl/…’) #15 /home/elegwlkl/seamar.ma/wp-blog-header.php(19): require_once(‘/home/elegwlkl/…’) #16 /home/elegwlkl/seamar.ma/index.php(17): require(‘/home/elegwlkl/…’) #17 {main} thrown in /home/elegwlkl/seamar.ma/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 3653 [21-Jul-2023 04:11:27 UTC] PHP Fatal error: Uncaught ValueError: Unknown format specifier “?” in /home/elegwlkl/seamar.ma/wp-content/plugins/woocommerce/includes/wc-template-functions.php:3653 Stack trace: #0 /home/elegwlkl/seamar.ma/wp-content/plugins/woocommerce/includes/wc-template-functions.php(3653): sprintf() #1 /home/elegwlkl/seamar.ma/wp-content/plugins/woocommerce/includes/wc-template-functions.php(3634): wc_get_star_rating_html() #2 /home/elegwlkl/seamar.ma/wp-content/themes/martfury/woocommerce/single-product/rating.php(43): wc_get_rating_html() #3 /home/elegwlkl/seamar.ma/wp-content/plugins/woocommerce/includes/wc-core-functions.php(345): include(‘/home/elegwlkl/…’) #4 /home/elegwlkl/seamar.ma/wp-content/plugins/woocommerce/includes/wc-template-functions.php(1645): wc_get_template() #5 /home/elegwlkl/seamar.ma/wp-content/themes/martfury/inc/frontend/woocommerce.php(2456): woocommerce_template_single_rating() #6 /home/elegwlkl/seamar.ma/wp-content/themes/martfury/inc/frontend/woocommerce.php(2432): Martfury_WooCommerce->get_single_product_header() #7 /home/elegwlkl/seamar.ma/wp-includes/class-wp-hook.php(308): Martfury_WooCommerce->single_product_header() #8 /home/elegwlkl/seamar.ma/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters() #9 /home/elegwlkl/seamar.ma/wp-includes/plugin.php(517): WP_Hook->do_action() #10 /home/elegwlkl/seamar.ma/wp-content/themes/martfury/woocommerce/content-single-product.php(46): do_action() #11 /home/elegwlkl/seamar.ma/wp-includes/template.php(785): require(‘/home/elegwlkl/…’) #12 /home/elegwlkl/seamar.ma/wp-content/plugins/woocommerce/includes/wc-core-functions.php(284): load_template() #13 /home/elegwlkl/seamar.ma/wp-content/plugins/woocommerce/templates/single-product.php(37): wc_get_template_part() #14 /home/elegwlkl/seamar.ma/wp-includes/template-loader.php(106): include(‘/home/elegwlkl/…’) #15 /home/elegwlkl/seamar.ma/wp-blog-header.php(19): require_once(‘/home/elegwlkl/…’) #16 /home/elegwlkl/seamar.ma/index.php(17): require(‘/home/elegwlkl/…’) #17 {main} thrown in /home/elegwlkl/seamar.ma/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 3653




    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi there @m0urd ??

    Thank you for contacting Woo support!

    Critical Error in Multilanguage site from Woocommerce Product rating

    Thank you for your patience! We are experiencing an unusually high volume of support requests at the moment, and that has affected our response times.

    As I understand, the reviews section on the front-end of your site displays an error message when an RTL language is selected. Correct?

    I went ahead with testing this, on a test installation of mine with just the WooCommerce plugin installed. The reviews section appeared without any issues, when an RTL language was selected in the site’s Settings > General screen. For reference:

    In English. Direct link to image: https://snipboard.io/Vit0qF.jpg
    With an RTL language selected. Direct link to image: https://snipboard.io/LwhES1.jpg

    The testing mentioned above points at the issue being a result of a plugin, or theme, conflict.

    after contacting WPML support they told me that the problem is from Woocommerce.

    Can you elaborate more on the findings from that interaction?

    I have made a sample video showing the issue because I can’t turn the website off or activate the option.

    It would be very helpful, for finding the culprit, if you could go ahead with testing for conflicts, following the guide linked here.

    Tools to help with troubleshooting

    Meks Quick Plugin Disabler will remember what plugins you had active when you switch it back on.

    You can clone your site to a staging environment and perform tests without modifying your live site or impacting customers. Many hosts provide staging facilities, so it’s worth checking in with them. It’s also possible to do it using the free WP Staging plugin.

    Please let us know how that goes.

    Thread Starter mourad

    (@m0urd)

    Hello @anastas10s,

    Thank you for your support and help.

    As mentioned in my open ticket the problem appears only when activating the Product ratings, the reviews are fine, I have disabled all plugins and enabled them one by one, and I use the web developer tool and error logs from the server to figure out the problem, I’m getting the same result
    this error appears in the error log many time:

    thrown in /home/elegwlkl/xxxx/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 3641 [21-Jun-2023 13:31:44 UTC] PHP Fatal error: Uncaught ValueError: Unknown format specifier “?” in /home/elegwlkl/sxxxx/wp-content/plugins/woocommerce/includes/wc-template-functions.php:3641 Stack trace: #0 /home/elegwlkl/xxxx/wp-content/plugins/woocommerce/includes/wc-template-functions.php(3641): sprintf() #1 /home/elegwlkl/xxxx/wp-content/plugins/woocommerce/includes/wc-template-functions.php(3622): wc_get_star_rating_html() #2 /home/elegwlkl/xxxx/wp-content/themes/martfury/woocommerce/single-product/rating.php(43): wc_get_rating_html() #3 /home/elegwlkl/xxxx/wp-content/plugins/woocommerce/includes/wc-core-functions.php(345): include(‘/home/elegwlkl/…’) #4 /home/elegwlkl/xxxx/wp-content/plugins/woocommerce/includes/wc-template-functions.php(1645): wc_get_template() #5 /home/elegwlkl/xxxx/wp-content/themes/martfury/inc/frontend/woocommerce.php(2456): woocommerce_template_single_rating() #6 /home/elegwlkl/xxxx/wp-content/themes/martfury/inc/frontend/woocommerce.php(2432): Martfury_WooCommerce->get_single_product_header() #7 /home/elegwlkl/xxxx/wp-includes/class-wp-hook.php(308): Martfury_WooCommerce->single_product_header() #8 /home/elegwlkl/xxxx/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters() #9 /home/elegwlkl/xxxx/wp-includes/plugin.php(517): WP_Hook->do_action() #10 /home/elegwlkl/xxxx/wp-content/themes/martfury/woocommerce/content-single-product.php(46): do_action() #11 /home/elegwlkl/xxxx/wp-includes/template.php(785): require(‘/home/elegwlkl/…’) #12 /home/elegwlkl/xxxx/wp-content/plugins/woocommerce/includes/wc-core-functions.php(284): load_template() #13 /home/elegwlkl/xxxx/wp-content/plugins/woocommerce/templates/single-product.php(37): wc_get_template_part() #14 /home/elegwlkl/xxxx/wp-includes/template-loader.php(106): include(‘/home/elegwlkl/…’) #15 /home/elegwlkl/xxxx/wp-blog-header.php(19): require_once(‘/home/elegwlkl/…’) #16 /home/elegwlkl/xxxx/index.php(17): require(‘/home/elegwlkl/…’) #17 {main}

    This is the class where the error appears :
    /wp-content/plugins/woocommerce/includes/wc-template-functions.php

    
    /**
     * Get HTML for star rating.
     *
     * @since  3.1.0
     * @param  float $rating Rating being shown.
     * @param  int   $count  Total number of ratings.
     * @return string
     */
    function wc_get_star_rating_html( $rating, $count = 0 ) {
    	$html = '<span style="width:' . ( ( $rating / 5 ) * 100 ) . '%">';
    
    	if ( 0 < $count ) {
    		/* translators: 1: rating 2: rating count */
    		$html .= sprintf( _n( 'Rated %1$s out of 5 based on %2$s customer rating', 'Rated %1$s out of 5 based on %2$s customer ratings', $count, 'woocommerce' ), '<strong class="rating">' . esc_html( $rating ) . '</strong>', '<span class="rating">' . esc_html( $count ) . '</span>' );
    	} else {
    		/* translators: %s: rating */
    		$html .= sprintf( esc_html__( 'Rated %s out of 5', 'woocommerce' ), '<strong class="rating">' . esc_html( $rating ) . '</strong>' );
    	}
    
    	$html .= '</span>';
    
    	return apply_filters( 'woocommerce_get_star_rating_html', $html, $rating, $count );
    }

    • This reply was modified 1 year, 8 months ago by mourad.

    Hi there, actually the error being thrown is by a template that overrides the WooCommerce default templates in your theme MartFury.

    wc_get_star_rating_html() #2 /home/elegwlkl/xxxx/wp-content/themes/martfury/woocommerce/single-product/rating.php(43):

    wc_get_template() #5 /home/elegwlkl/xxxx/wp-content/themes/martfury/inc/frontend/woocommerce.php(2456): woocommerce_template_single_rating() #6 /home/elegwlkl/xxxx/wp-content/themes/martfury/inc/frontend/woocommerce.php(2432): Martfury_WooCommerce->get_single_product_header() #7

    Martfury_WooCommerce->get_single_product_header() #7 /home/elegwlkl/xxxx/wp-includes/class-wp-hook.php(308): Martfury_WooCommerce->single_product_header() #8 /home/elegwlkl/xxxx/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters() #9

    Try switching your theme to a default theme like Storefront or Twenty Twenty Three and enable product ratings and see if the issue persists, please.

    If the issue does not persist with a default theme, contact the authors of your MartFury theme and let them know the issue with RTL language and WooCommerce product ratings feature. They’ll need to update the ratings template they use to correct the issue and then you’ll need to update your theme after the fix to see it live on your site.

    Let us know the results of your testing! We’re here to help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Critical Error in Multilanguage site from Woocommerce Product rating’ is closed to new replies.