• Resolved atai66

    (@atai66)


    Hi
    After a call to stripe to process a card payment the screen is displaying the “There has been a critical error on this website” message. The payment is accepted, the order status is left at ‘pending’. All processing is stopped at this point. This is occurring at irregular intervals; not with every order.

    2. Error log message
    ====================
    [11-Apr-2022 23:27:14 UTC] PHP Fatal error: Uncaught Error: Call to undefined method WC_Order::get_id() in /home/…/public_html/donate/wp-content/plugins/woocommerce-gateway-stripe/includes/class-wc-gateway-stripe.php:981
    Stack trace:
    #0 /home/…/public_html/donate/wp-content/plugins/woocommerce-gateway-stripe/includes/class-wc-stripe-intent-controller.php(102): WC_Gateway_Stripe->verify_intent_after_checkout(Object(WC_Order))
    #1 /home/…/public_html/donate/wp-includes/class-wp-hook.php(287): WC_Stripe_Intent_Controller->verify_intent(”)
    #2 /home/…/public_html/donate/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(”, Array)
    #3 /home/…/public_html/donate/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
    #4 /home/…/public_html/donate/wp-content/plugins/woocommerce/includes/class-wc-ajax.php(82): do_action(‘wc_ajax_wc_stri…’)
    #5 /home/…/public_html/donate/wp-includes/class-wp-hook.php(287): WC_AJAX::do_wc_ajax(”)
    #6 /home/…/public_html/donate/wp-includes/class-wp-hook.php(311): WP_H in /home/…/public_html/donate/wp-content/plugins/woocommerce-gateway-stripe/includes/class-wc-gateway-stripe.php on line 981

    3. class-wc-gateway-stripe.php
    ===========================
    /**
    * Executed between the “Checkout” and “Thank you” pages, this
    * method updates orders based on the status of associated PaymentIntents.
    *
    * @since 4.2.0
    * @param WC_Order $order The order which is in a transitional state.
    */
    public function verify_intent_after_checkout( $order ) {
    $payment_method = WC_Stripe_Helper::is_wc_lt( ‘3.0’ ) ? $order->payment_method : $order->get_payment_method();
    if ( $payment_method !== $this->id ) {
    // If this is not the payment method, an intent would not be available.
    return;
    }

    $intent = $this->get_intent_from_order( $order );
    if ( ! $intent ) {
    // No intent, redirect to the order received page for further actions.
    return;
    }

    // A webhook might have modified or locked the order while the intent was retreived. This ensures we are reading the right status.
    ****** clean_post_cache( $order->get_id() ); ******** LINE 981 ************
    $order = wc_get_order( $order->get_id() );

    if ( ‘pending’ !== $order->get_status() && ‘failed’ !== $order->get_status() ) {
    // If payment has already been completed, this function is redundant.
    return;
    }

    if ( $this->lock_order_payment( $order, $intent ) ) {

    4. WordPress system report
    ==========================

    ### WordPress Environment ###

    WC Version: 2.6.14
    Log Directory Writable: ?
    WP Version: 5.4.2
    WP Multisite: –
    WP Memory Limit: 11 GB
    WP Debug Mode: –
    WP Cron: ?
    Language: en_US

    ### Server Environment ###

    Server Info: Apache
    PHP Version: 7.0.33
    PHP Post Max Size: 888 MB
    PHP Time Limit: 1000
    PHP Max Input Vars: 1000
    cURL Version: 7.81.0
    OpenSSL/1.1.1n

    SUHOSIN Installed: –
    MySQL Version: 5.7.37
    Max Upload Size: 6 MB
    Default Timezone is UTC: ?
    fsockopen/cURL: ?
    SoapClient: ? Your server does not have the SoapClient class enabled – some gateway plugins which use SOAP may not work as expected.
    DOMDocument: ?
    GZip: ?
    Multibyte String: ?
    Remote Post: ?
    Remote Get: ?

    ### Database ###

    WC Database Version: 2.6.14
    :
    woocommerce_sessions: ?
    woocommerce_api_keys: ?
    woocommerce_attribute_taxonomies: ?
    woocommerce_downloadable_product_permissions: ?
    woocommerce_order_items: ?
    woocommerce_order_itemmeta: ?
    woocommerce_tax_rates: ?
    woocommerce_tax_rate_locations: ?
    woocommerce_shipping_zones: ?
    woocommerce_shipping_zone_locations: ?
    woocommerce_shipping_zone_methods: ?
    woocommerce_payment_tokens: ?
    woocommerce_payment_tokenmeta: ?
    MaxMind GeoIP Database: ?

    ### Active Plugins (28) ###

    Gravity Perks: by Gravity Wiz – 1.2.18.6
    Gravity Forms: by rocketgenius – 2.3.2.2
    BlueSnap Payment Gateway for WooCommerce: by Bluesnap – 1.3.4.1
    Custom Reporting Pro: by Stuart Elliot – 0.1
    ClickToAddress Auto-Complete Integration: by Crafty Clicks – 1.1.11
    Corona Virus (COVID-19) Banner & Live Data: by Orchestrated – 1.7.0.2
    Google Tag Manager for WordPress: by Thomas Geiger – 1.14.2
    Facebook for WooCommerce: by Facebook – 2.2.0
    Gift Aid for WooCommerce: by Dave Green – 1.3.5
    GP eCommerce Fields: by Gravity Wiz – 1.0.beta1.7
    Gravity Forms Reset Button Add-On: by Able Engine & William Wilkerson – 1.0
    GP Price Range: by David Smith – 1.0.4
    MailChimp for WooCommerce: by MailChimp – 2.1.8
    Smart Debit: by Digispace Marketing – 1.0
    Woo Donations: by Geek Web Solution – 1.4
    Advanced Order Export For WooCommerce: by AlgolPlus – 1.5.6
    Bolder Fees for WooCommerce: by Bolder Elements – 1.4.19
    WooCommerce Cart Tab: by jameskoster – 1.1.2
    WooCommerce Checkout Add-Ons: by SkyVerge – 1.11.0
    WooCommerce Checkout Field Editor: by WooCommerce – 1.5.21
    Direct Checkout for WooCommerce: by QuadLayers – 2.4.3
    WooCommerce Stripe Gateway: by WooCommerce – 4.2.4
    WooCommerce – Gravity Forms Product Add-Ons: by Lucas Stark – 3.1.10 – 3.3.26 is available
    WooCommerce Subscribe All the Things: by Prospress Inc. – 1.1.2
    WooCommerce Subscriptions: by Prospress Inc. – 2.2.4
    WooCommerce: by WooThemes – 2.6.14
    WP Downgrade | Specific Core Version: by Reisetiger – 1.2.2
    WP Rollback: by Impress.org – 1.7.1

    ### Settings ###

    Force SSL: ?
    Currency: GBP (£)
    Currency Position: left
    Thousand Separator: ,
    Decimal Separator: .
    Number of Decimals: 2

    ### API ###

    API Enabled: ?

    ### WC Pages ###

    Shop Base: ? Page ID is set
    but the page does not exist

    Cart: #5 – /cart/
    Checkout: #6 – /checkout/
    My Account: #7 – /my-account/

    ### Taxonomies ###

    Product Types: external (external)
    grouped (grouped)
    simple (simple)
    subscription (subscription)
    variable (variable)
    variable subscription (variable-subscription)

    ### Theme ###

    Name: Storefront
    Version: 2.3.2
    Author URL: https://woocommerce.com/
    Child Theme: ? – If you’re modifying WooCommerce on a parent theme you didn’t build personally
    then we recommend using a child theme. See: How to create a child theme

    WooCommerce Support: ?

    ### Templates ###

    Overrides: storefront 2/woocommerce/archive-product.php
    storefront 2/woocommerce/auth/footer.php
    storefront 2/woocommerce/auth/form-grant-access.php
    storefront 2/woocommerce/auth/form-login.php
    storefront 2/woocommerce/auth/header.php
    storefront 2/woocommerce/cart/cart-empty.php
    storefront 2/woocommerce/cart/cart-item-data.php
    storefront 2/woocommerce/cart/cart-shipping.php
    storefront 2/woocommerce/cart/cart-totals.php
    storefront 2/woocommerce/cart/cart.php
    storefront 2/woocommerce/cart/cross-sells.php
    storefront 2/woocommerce/cart/mini-cart.php
    storefront 2/woocommerce/cart/proceed-to-checkout-button.php
    storefront 2/woocommerce/cart/shipping-calculator.php
    storefront 2/woocommerce/checkout/cart-errors.php
    storefront 2/woocommerce/checkout/form-billing.php
    storefront 2/woocommerce/checkout/form-checkout.php
    storefront 2/woocommerce/checkout/form-coupon.php
    storefront 2/woocommerce/checkout/form-login.php
    storefront 2/woocommerce/checkout/form-pay.php
    storefront 2/woocommerce/checkout/form-shipping.php
    storefront 2/woocommerce/checkout/payment-method.php
    storefront 2/woocommerce/checkout/payment.php
    storefront 2/woocommerce/checkout/review-order.php
    storefront 2/woocommerce/checkout/terms.php
    storefront 2/woocommerce/checkout/thankyou.php
    storefront 2/woocommerce/content-product.php
    storefront 2/woocommerce/content-product_cat.php
    storefront 2/woocommerce/content-single-product.php
    storefront 2/woocommerce/content-widget-product.php
    storefront 2/woocommerce/emails/admin-cancelled-order.php
    storefront 2/woocommerce/emails/admin-failed-order.php
    storefront 2/woocommerce/emails/admin-new-order.php
    storefront 2/woocommerce/emails/customer-completed-order.php
    storefront 2/woocommerce/emails/customer-invoice.php
    storefront 2/woocommerce/emails/customer-new-account.php
    storefront 2/woocommerce/emails/customer-note.php
    storefront 2/woocommerce/emails/customer-on-hold-order.php
    storefront 2/woocommerce/emails/customer-processing-order.php
    storefront 2/woocommerce/emails/customer-refunded-order.php
    storefront 2/woocommerce/emails/customer-reset-password.php
    storefront 2/woocommerce/emails/email-addresses.php
    storefront 2/woocommerce/emails/email-customer-details.php
    storefront 2/woocommerce/emails/email-footer.php
    storefront 2/woocommerce/emails/email-header.php
    storefront 2/woocommerce/emails/email-order-details.php
    storefront 2/woocommerce/emails/email-order-items.php
    storefront 2/woocommerce/emails/email-styles.php
    storefront 2/woocommerce/emails/plain/admin-cancelled-order.php
    storefront 2/woocommerce/emails/plain/admin-failed-order.php
    storefront 2/woocommerce/emails/plain/admin-new-order.php
    storefront 2/woocommerce/emails/plain/customer-completed-order.php
    storefront 2/woocommerce/emails/plain/customer-invoice.php
    storefront 2/woocommerce/emails/plain/customer-new-account.php
    storefront 2/woocommerce/emails/plain/customer-note.php
    storefront 2/woocommerce/emails/plain/customer-on-hold-order.php
    storefront 2/woocommerce/emails/plain/customer-processing-order.php
    storefront 2/woocommerce/emails/plain/customer-refunded-order.php
    storefront 2/woocommerce/emails/plain/customer-reset-password.php
    storefront 2/woocommerce/emails/plain/email-addresses.php
    storefront 2/woocommerce/emails/plain/email-customer-details.php
    storefront 2/woocommerce/emails/plain/email-order-details.php
    storefront 2/woocommerce/emails/plain/email-order-items.php
    storefront 2/woocommerce/global/breadcrumb.php
    storefront 2/woocommerce/global/form-login.php
    storefront 2/woocommerce/global/quantity-input.php
    storefront 2/woocommerce/global/sidebar.php
    storefront 2/woocommerce/global/wrapper-end.php
    storefront 2/woocommerce/global/wrapper-start.php
    storefront 2/woocommerce/loop/add-to-cart.php
    storefront 2/woocommerce/loop/loop-end.php
    storefront 2/woocommerce/loop/loop-start.php
    storefront 2/woocommerce/loop/no-products-found.php
    storefront 2/woocommerce/loop/orderby.php
    storefront 2/woocommerce/loop/pagination.php
    storefront 2/woocommerce/loop/price.php
    storefront 2/woocommerce/loop/rating.php
    storefront 2/woocommerce/loop/result-count.php
    storefront 2/woocommerce/loop/sale-flash.php
    storefront 2/woocommerce/myaccount/dashboard.php
    storefront 2/woocommerce/myaccount/downloads.php
    storefront 2/woocommerce/myaccount/form-add-payment-method.php
    storefront 2/woocommerce/myaccount/form-edit-account.php
    storefront 2/woocommerce/myaccount/form-edit-address.php
    storefront 2/woocommerce/myaccount/form-login.php
    storefront 2/woocommerce/myaccount/form-lost-password.php
    storefront 2/woocommerce/myaccount/form-reset-password.php
    storefront 2/woocommerce/myaccount/lost-password-confirmation.php
    storefront 2/woocommerce/myaccount/my-account.php
    storefront 2/woocommerce/myaccount/my-address.php
    storefront 2/woocommerce/myaccount/my-downloads.php
    storefront 2/woocommerce/myaccount/my-orders.php
    storefront 2/woocommerce/myaccount/navigation.php
    storefront 2/woocommerce/myaccount/orders.php
    storefront 2/woocommerce/myaccount/payment-methods.php
    storefront 2/woocommerce/myaccount/view-order.php
    storefront 2/woocommerce/notices/error.php
    storefront 2/woocommerce/notices/notice.php
    storefront 2/woocommerce/notices/success.php
    storefront 2/woocommerce/order/form-tracking.php
    storefront 2/woocommerce/order/order-again.php
    storefront 2/woocommerce/order/order-details-customer.php
    storefront 2/woocommerce/order/order-details-item.php
    storefront 2/woocommerce/order/order-details.php
    storefront 2/woocommerce/order/tracking.php
    storefront 2/woocommerce/product-searchform.php
    storefront 2/woocommerce/single-product/add-to-cart/external.php
    storefront 2/woocommerce/single-product/add-to-cart/grouped.php
    storefront 2/woocommerce/single-product/add-to-cart/simple.php
    storefront 2/woocommerce/single-product/add-to-cart/variable.php
    storefront 2/woocommerce/single-product/add-to-cart/variation-add-to-cart-button.php
    storefront 2/woocommerce/single-product/add-to-cart/variation.php
    storefront 2/woocommerce/single-product/meta.php
    storefront 2/woocommerce/single-product/price.php
    storefront 2/woocommerce/single-product/product-attributes.php
    storefront 2/woocommerce/single-product/product-image.php
    storefront 2/woocommerce/single-product/product-thumbnails.php
    storefront 2/woocommerce/single-product/rating.php
    storefront 2/woocommerce/single-product/related.php
    storefront 2/woocommerce/single-product/review-meta.php
    storefront 2/woocommerce/single-product/review-rating.php
    storefront 2/woocommerce/single-product/review.php
    storefront 2/woocommerce/single-product/sale-flash.php
    storefront 2/woocommerce/single-product/share.php
    storefront 2/woocommerce/single-product/short-description.php
    storefront 2/woocommerce/single-product/tabs/additional-information.php
    storefront 2/woocommerce/single-product/tabs/description.php
    storefront 2/woocommerce/single-product/tabs/tabs.php
    storefront 2/woocommerce/single-product/title.php
    storefront 2/woocommerce/single-product/up-sells.php
    storefront 2/woocommerce/single-product-reviews.php
    storefront 2/woocommerce/single-product.php
    storefront 2/woocommerce/taxonomy-product_cat.php
    storefront 2/woocommerce/taxonomy-product_tag.php

    ### subscriptions ###

    WCS_DEBUG: ? No
    Subscriptions Mode: ? Live
    `

    What does ” PHP Fatal error: Uncaught Error: Call to undefined method WC_Order::get_id() in /home/…/public_html/donate/wp-content/plugins/woocommerce-gateway-stripe/includes/class-wc-gateway-stripe.php:981″ mean?

    I need to try and fix this without any plugin updates or downtime as the site currently has heavy traffic and cannot afford any downtime if plugins updates fail.

    Can I comment out this line ” clean_post_cache( $order->get_id() );” ?

    Thank you
    Annie

Viewing 1 replies (of 1 total)
  • Hello,

    As a first step please be sure to update WooCommerce you can find more information on this documentation below:
    https://woocommerce.com/document/how-to-update-woocommerce/

    WooCommerce Stripe Gateway: by WooCommerce – 4.2.4

    Also, be sure to update your plugins, for example, Stripe payment gateway’s current version is 6.3.0.

    If you do not want to touch the production site you can test using a staging site, for this purpose we recommend WP Staging for quickly spinning up a new test site.

    Let us know if after performing the updates the issue is still present, thank you.

    • This reply was modified 2 years, 11 months ago by Igor H.
Viewing 1 replies (of 1 total)
  • The topic ‘Fatal Error in class-wc-gateway-stripe.php’ is closed to new replies.