[Resolved] Fatal error when changing product variation
This thread is resolved. Here is a description of the problem and solution.
Problem:
When the client attempts to change a product variation, such as inserting a sale price and saving, the process does not complete, and the spinning icon persists. An error indicating 'PHP Fatal error: Uncaught Error: Call to a member function get_stock_quantity() on bool' appears in the logs.
Solution:
If you're experiencing a similar issue when saving product variations, we recommend trying the following steps in your WordPress admin area:
1. Navigate to WooCommerce -> WooCommerce Multilingual & Multicurrency -> Status -> Troubleshooting.
2. Execute the following troubleshooting options:
- "Sync product stock quantity and status"
- "Fix translated variations relationships"
- "Sync removed product meta from original products to translations"
Please ensure you take a full backup of your website and database before proceeding with these steps.
Keep in mind that this solution might be outdated or not applicable to your specific case. If the issue persists, we highly recommend checking the related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you still need assistance, please do not hesitate to open a new support ticket in the WPML support forum.
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
When changing a production variation, in this case insert a sale price and click on save the save will not finish and the spinning donut stays. I see an error in the log:
[Thu Feb 08 15:22:24.667276 2024] [proxy_fcgi:error] [pid 28678:tid 140419014797056] [client 2a02:a465:d20f:1:eda5:64bd:b9e2:1c71:0] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to a member function get_stock_quantity() on bool in /home/381534.cloudwaysapps.com/gsggkexeze/public_html/wp-content/plugins/woocommerce-multilingual/inc/translation-editor/class-wcml-synchronize-product-data.php:350\nStack trace:\n#0 /home/381534.cloudwaysapps.com/gsggkexeze/public_html/wp-content/plugins/woocommerce-multilingual/inc/translation-editor/class-wcml-synchronize-variations-data.php(200): WCML_Synchronize_Product_Data->sync_product_stock()\n#1 /home/381534.cloudwaysapps.com/gsggkexeze/public_html/wp-content/plugins/woocommerce-multilingual/inc/translation-editor/class-wcml-synchronize-variations-data.php(60): WCML_Synchronize_Variations_Data->sync_product_variations()\n#2 /home/381534.cloudwaysapps.com/gsggkexeze/public_html/wp-includes/class-wp-hook.php(324): WCML_Synchronize_Variations_Data->sync_product_variations_action()\n#3 /home/381534.cloudwaysapps.com/gsggkexeze/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filt...', referer: hidden link
please try the following options in wp-admin -> WooCommerce -> WooCommerce Multilingual & Multicurrency -> Status -> Troubleshooting:
- "Sync product stock quantity and status"
- "Fix translated variations relationships"
- "Sync removed product meta from original products to translations"
IMPORTANT: Take full backup of your website and database beforehand.
Thanks for your reply. I've tried the three items.
- "Fix translated variations relationships", ran succesfully after two attempts
- "Sync removed product meta from original products to translations", ran succesfully
- "Sync product stock quantity and status" is not working. The count doesn't increase, spinning wheel in right corner stays. Status unchanged for last 30 minutes.
The PHP Time limit and Memory Limit of the site looks OK which would not explain a timeout.
Were there any fatal errors when running the Troubleshooting action or Console errors?
I would like to request temporary access (wp-admin and FTP) to your site to test the issue.
(preferably to a test site where the problem has been replicated if possible)
**Before we proceed It is necessary to take FULL BACKUP of your database and your website. Providing us with access, you agree that a backup has been taken **
I often use the Duplicator plugin for this purpose: http://wordpress.org/plugins/duplicator/
You will find the needed fields for this below the comment area when you log in to leave your next reply.
The information you enter is private which means only you and I have access to it.
NOTE: If access to the live site is not possible and the staging site does not exist please provide me with a duplicator package created with the duplicator plugin.
I was able to finish the sync but it did not help. (note that the # will reset once done, it does not show 0. This is expected)
Also, I was able to reproduce the error as seen in your loom video. If you reload the page after the error it looks like the new price is taking effect.
I am further investigating the error locally and will update you shortly
Unfortunately, I have not been able to reproduce this locally, and exporting a copy of the site or migrating to our servers has failed each time attempted.
Are we able to test on your site with a minimal environment? (deactivating plugins and themes) or do you have a staging environment available to further investigate as I don't feel comfortable performing these tests on a production site without permission first.
I've created a staging site but couldn't replicate the issue. So I investigated server settings and did some tweaking of settings (changed them to match an identical server). The issue seems to be solved now. Can you confirm this by doing a test yourself?