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)
- This topic has 3 replies, 2 voices, and was last updated 2 hours, 56 minutes ago by
Luke Nielsen.
-
AuthorPosts
-
April 29, 2025 at 6:44 pm #657362
aahmetaaksoyParticipantHello,
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,
AhmetAttachments:
You must be logged in to view attached files.April 30, 2025 at 10:45 am #657458
Luke NielsenKeymasterHello,
May I disable 3rd party plugins and enable the parent/default theme for testing?
Looking forward to collaborating with you!
Kind Regards
April 30, 2025 at 12:35 pm #657498
aahmetaaksoyParticipantMerhaba sorun ödeme sistemindeymiş sorunu çözdüm fakat şimdi mağaza filtresinde bir sorun yaşıyorum kategorilerde sol tarafta filtreler gözükmüyor
April 30, 2025 at 2:48 pm #657534
Luke NielsenKeymasterHello,
First, why does your shop page have the shortcode that is related to the Checkout page? https://prnt.sc/FWms_YJwuYLL -> https://prnt.sc/9VeSCJpQDcWW
In general, the sidebar is hidden via the settings of the page – https://prnt.sc/HMvHeM2TJNrK
Kind Regards
-
AuthorPosts
- You must be logged in to create new topics. Login / Register