If you’re getting the following error:
PHP Fatal error: Uncaught TypeError: Unsupported operand types: string - int in ../wp-content/plugins/woocommerce/src/Internal/Admin/WCPayPromotion/Init.php:88
This error can cause your WordPress admin not functioning properly. For example if you go to WordPress block editor (Gutenberg), it will not save your changes. Etc.
Issue is with poor WooCommerce compatibility with PHP 8. Fortunately, there’s a fairly easy fix. Just do the following few steps to fix the issue:
- Comment out code on line number 88 in file wp-content/plugins/woocommerce/src/Internal/Admin/WCPayPromotion/Init.php
- It will like as follows: # $ordering[ $id ] = $is_empty ? 0 : ( min( $ordering ) – 1 );
- Go to your WordPress admin and go to WooCommerce – Settings – Payments
- Reorder payment methods
- Congratulations, you have fixed the fatal error for good, you can now also update the WooCommerce to the newer version if there’s any available.
- You can go back to the file wp-content/plugins/woocommerce/src/Internal/Admin/WCPayPromotion/Init.php and now you can uncomment the like 99 or just leave it as it is…
I’m sure this tutorial helped you resolve your WooCommerce issues. Once you’re here, feel free to try our Citadela theme for free.