Home Forums WoodMart support forum WooCommerce Thank You Page Error – $product is Null (After Paynet Payment)

WooCommerce Thank You Page Error – $product is Null (After Paynet Payment)

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #657362

    aahmetaaksoy
    Participant

    Hello,

    I’m currently experiencing a critical issue with the WooCommerce integration on the Woodmart theme. Below are the details of the problem:

    I’m using the Woodmart theme along with the Paynet payment gateway plugin for WooCommerce. The payment process completes successfully; however, after the transaction, when the user is redirected to the default WooCommerce “thank you” page, a fatal error occurs in the single-product/product-image.php template file:

    PHP Fatal error: Uncaught Error: Call to a member function get_gallery_image_ids() on null
    in /themes/woodmart/woocommerce/single-product/product-image.php:27
    This happens because the $product object is null at that moment. It seems that the Paynet plugin does not pass a valid $product instance upon redirect, and the theme template is attempting to use it without validation.

    To prevent this, I tried adding the following conditional check at the beginning of the product-image.php file:

    global $product;
    if ( ! $product ) {
    $product = wc_get_product( get_the_ID() );
    }
    if ( ! is_a( $product, ‘WC_Product’ ) ) {
    return;
    }
    Unfortunately, the issue persists. It is likely that other WooCommerce template files within the theme are also accessing the $product object without proper validation, causing the site to crash on the “thank you” page with a critical error message.

    What I kindly request:
    Please consider implementing safer checks before using the $product object within WooCommerce templates.
    Ideally, ensure that components dependent on product data do not load or execute on pages like the order confirmation (thank you) page where $product may not be available.
    I would greatly appreciate your help in resolving this issue. I can provide error logs and screenshots if necessary.

    Thank you in advance,
    Ahmet

    Attachments:
    You must be logged in to view attached files.
    #657458

    Luke Nielsen
    Keymaster

    Hello,

    May I disable 3rd party plugins and enable the parent/default theme for testing?

    Looking forward to collaborating with you!

    Kind Regards

    #657498

    aahmetaaksoy
    Participant

    Merhaba sorun ödeme sistemindeymiş sorunu çözdüm fakat şimdi mağaza filtresinde bir sorun yaşıyorum kategorilerde sol tarafta filtreler gözükmüyor

Viewing 3 posts - 1 through 3 (of 3 total)