Support » Plugin: WooCommerce Force Default Variant » Fatal error – is_type()

  • Resolved matiasvalle

    (@matiasvalle)


    Hi! We have a problem with a client, we’re getting a fatal error on some products. This is the log:

    [19-Dec-2018 14:00:44 UTC] PHP Fatal error: Uncaught Error: Call to a member function is_type() on string in public_html/wp-content/plugins/force-default-variant-for-woocommerce/includes/variations.php:98
    Stack trace:
    #0 public_html/wp-includes/class-wp-hook.php(288): hpy_fdv_default_attribute(Array)
    #1 public_html/wp-includes/plugin.php(203): WP_Hook->apply_filters(Array, Array)
    #2 public_html/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-data.php(726): apply_filters(‘woocommerce_pro…’, Array, Object(WC_Product_Variable))
    #3 public_html/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-product.php(546): WC_Data->get_prop(‘default_attribu…’, ‘view’)
    #4 public_html/wp-content/plugins/pyp/includes/class-pyp-product-settings.php(377): WC_Product->get_default_attributes()
    #5 public_html/wp-content/plugins/pyp/includes/class-pyp-frontend.php(615): sumo_pyp_get_variation_attributes(Object(WC_Product_Variable))
    #6 /ho in public_html/wp-content/plugins/force-default-variant-for-woocommerce/includes/variations.php on line 98

    All the plugins are updated, thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author HappyKite

    (@happykite)

    Hi Matias,

    Can I ask what other plugins you are using please?

    From the sounds of it you have a plugin that is modifying the Variation output for WooCommerce.

    Thanks,
    Mike

    Plugin Author HappyKite

    (@happykite)

    Hi again,

    Are you able to try adding the below code to includes/variations.php on line 87 please.

    if ( $product->post_type !== 'product' ) {
    	return $defaults;
    }

    Then let me know if that helps fix your issue.

    Thanks,
    Mike

    • This reply was modified 1 year, 10 months ago by HappyKite.

    Hi Mike! Now it’s working again, I replaced this on line 83 for the code you sent me:

    if ( !$product ) {
    	return $defaults;
    }

    Will we have to change again the code on the next update?

    Thank you, love your plugin!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Fatal error – is_type()’ is closed to new replies.