Support » Plugin: WooCommerce Force Default Variant » Fatal Error – 1.4

  • Resolved functionjunc

    (@functionjunc)


    I just updated to 1.4 and I’m getting this error.

    Fatal error</b>: Uncaught Error: Call to a member function get_attributes() on boolean in /home/funct673/public_html/wp-content/plugins/force-default-variant-for-woocommerce/includes/variations.php:156

    Can you provide a code fix or help with this issue? I love the plugin, it does exactly what we need.

    Thanks,

    FJ

Viewing 1 replies (of 1 total)
  • Plugin Author HappyKite

    (@happykite)

    Hi FJ,

    Sorry you are having an issue with my plugin. I’ve had a quick look and the code change below should help you fix this issue.

    If you head to line 155 you will see the following.

    $_prod = wc_get_product( $attributes[0]['id'] );
    $attr = $_prod->get_attributes();

    Can you change line 155 and 156, from the above, to what is below. I have made this same change so this won’t be removed on the next update.

    $_prod = wc_get_product( $attributes[0]['id'] );
    	
    if ( empty( $_prod ) ) {
    	return $defaults;
    }
    	
    $attr = $_prod->get_attributes();

    Thanks,
    Mike

Viewing 1 replies (of 1 total)
  • The topic ‘Fatal Error – 1.4’ is closed to new replies.