• Resolved noxstyle

    (@noxstyle)


    Hi!

    The latest update (4.4.0) breaks composite products support IF the site is not using the woocommerce-multilingual built in multi currency plugin. At least this is the case with 3rd party multi currency plugins in place (the site I’m working on uses WOOCS – Currency switcher).

    The issue happens on:
    wp-content/plugins/woocommerce-multilingual/compatibility/class-wcml-composite-products.php:L561

    There is a function for applying rounding rules:

    
    public function apply_rounding_rules( $price ) {
    	return $this->woocommerce_wpml->multi_currency->prices->apply_rounding_rules( $price );
    }
    

    This on the other hand calls a method from $woocommerce_wpml->multi_currency which is null, if the enable_multi_currency setting on woocommerce-multilingual is not enabled.

    This throws Fatal errors rendering the whole site unusable.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter noxstyle

    (@noxstyle)

    Also viewing an order throws fatal error:
    Fatal error: Uncaught Error: Call to a member function get_type() on boolean in /wp-content/plugins/woocommerce-multilingual/compatibility/class-wcml-composite-products.php on line 463

    caused by: wc_get_product( $_GET[ 'post' ] ) as the wc_get_product() returns false for non-product ID’s.

    Thank you for reporting this.
    Our developers are already aware of some problems related to composite products and multi-currency and they are working on a fix for them.

    Hi George,

    Do you have any ETA for this fix?

    Hello!
    We are in the process of completing a new version with a fix for the issue.
    I cannot give exact ETA at the moment as the devs are working hard on fixing issues, but I guess it will be very soon.

    @bebski @noxstyle we just released a version that should help and fix the issue.

    Thanks for the reply.
    I’ve installed the update, hover the issue is still there. Maybe mine is different than noxstyle. It’s occurs when I’m goin to the order details in admin panel.

    For now I’ve downgraded the plugin and it’s OK.

    Here’s my debug.

    Fatal error: Uncaught Error: Call to a member function get_type() on boolean in /server_path/public_html/wp-content/plugins/woocommerce-multilingual/compatibility/class-wcml-composite-products.php:463 Stack trace: #0 /server_path/public_html/wp-includes/class-wp-hook.php(286): WCML_Composite_Products->load_assets('') #1 /server_path/public_html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array) #2 /server_path/public_html/wp-includes/plugin.php(453): WP_Hook->do_action(Array) #3 /server_path/public_html/wp-settings.php(450): do_action('init') #4 /server_path/public_html/wp-config.php(78): require_once('/server_path/...') #5 /server_path/public_html/wp-load.php(37): require_once('/server_path/...') #6 /server_path/public_html/wp-admin/admin.php(31): require_once('/server_path/...') #7 /server_path/public_html/w in /server_path/public_html/wp-content/plugins/woocommerce-multilingual/compatibility/class-wcml-composite-products.php on line 463

    Thank you for your report @bebski
    Yes, that is a different case.
    I am escalating that to our developers for further fixing.

    Our developers provided me with a quick fix for you @bebski
    Go to the file and change:

    
    		if( ( $pagenow == 'post.php' && isset( $_GET[ 'post' ] ) && wc_get_product( $_GET[ 'post' ] )->get_type() === 'composite' ) || $pagenow == 'post-new.php' ){
    

    to

    
    		$is_composite_edit_page = false;
    
    		if( $pagenow == 'post.php' && isset( $_GET[ 'post' ] ) ){
    			$wc_product = wc_get_product( $_GET[ 'post' ] );
    			if( $wc_product && $wc_product->get_type() === 'composite' ){
    				$is_composite_edit_page = true;
    			}
    		}
    
    		if( $is_composite_edit_page || $pagenow == 'post-new.php' ){
    
    

    I hope it helps you.

    • This reply was modified 5 years, 2 months ago by George Botsev. Reason: fixing patch code

    Thank you!

    Plugin Contributor Andreas Panag

    (@andrewp-2)

    Since we don’t have news for some time, I am closing this ticket.

    If you still have problem, please feel free to open a ticket in wpml.org so we can help you.

    Thank you very much

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘4.4.0 breaks composite products support’ is closed to new replies.