• Resolved raghavlalit

    (@raghavlalit)


    Hello,
    We get getting fatal errors since our last update. We have upgraded from 1.9.2 to 1.9.5
    Here is the complete error for you r reference –

    Fatal error: Uncaught Error: Call to a member function is_in_stock() on array in /www/mountainarchery_228/public/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-button/src/Assets/SmartButton.php:1419 Stack trace: #0 /www/mountainarchery_228/public/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-button/src/Assets/SmartButton.php(1365): WooCommerce\PayPalCommerce\Button\Assets\SmartButton->has_in_stock_variation(Array) #1 /www/mountainarchery_228/public/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-button/src/Assets/SmartButton.php(431): WooCommerce\PayPalCommerce\Button\Assets\SmartButton->product_supports_payment(Object(Premmerce\Optimizer\WooCommerce\Proxy\ProductVariableLite)) #2 /www/mountainarchery_228/public/wp-includes/class-wp-hook.php(307): WooCommerce\PayPalCommerce\Button\Assets\SmartButton->WooCommerce\PayPalCommerce\Button\Assets\{closure}(”) #3 /www/mountainarchery_228/public/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array) #4 /www/mountainarchery_ in /www/mountainarchery_228/public/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-button/src/Assets/SmartButton.php on line 1419
    There has been a critical error on this website.

    When I debug this issue, i found a function like –
    protected function has_in_stock_variation( array $variations ): bool {
    foreach ( $variations as $variation ) {
    if ( $variation->is_in_stock() ) {
    return true;
    }
    }
    return false;
    }

    And when I updated this like –

    protected function has_in_stock_variation( array $variations ): bool {
    foreach ( $variations as $variation ) {
    if ( isset($variation[‘is_in_stock’]) && $variation[‘is_in_stock’]==1 ) {
    return true;
    }
    }

    return false;
    }

    It works fine, please let me know why we are getting error, is there any conflict with other plugin ? what should we do next to resolve this properly ?
    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Syde Niklas

    (@niklasinpsyde)

    Hi @raghavlalit,

    It looks like this could be a compatibility issue with a third-party plugin.

    You may want to perform a full conflict test to rule out eventual issues with the theme or a different plugin. We recommend temporarily activating the default theme Storefront and disabling all other plugins except for?WooCommerce and?PayPal Payments to see if the behavior persists.
    I would probably start with disabling the woocommerce-performance-optimizer plugin to see if the error persists as this plugin is mentioned in the stack trace.

    Here’s a guide that explains the steps in more detail: How to test for conflicts
    Please let us know how this works out for you. Thanks!

    Kind regards,
    Niklas

    Plugin Support Syde Joost

    (@joostvandevijver)

    Hello,

    since we did not receive any response or follow-up questions from you, we will assume you got this working to your requirements. If you still have any more questions for us, please open a new thread, because we will mark this one as resolved.

    Kind regards,
    Joost

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘A critical error being triggered with smartButton after last update’ is closed to new replies.