Fatal PHP Error on Cart and Checkout pages
-
The Cart and Checkout pages stopped working due to a PHP error. I have checked the code and I have a quick fix going but i don’t know if it could be done better.
Error: PHP Fatal error: Uncaught Error: Cannot unset offset in a non-array variable in /flexible-checkout-fields/classes/plugin.php (lines 235 and 266)
Code for lines 235 – 239:
if (is_array($base[ $key ])) {
unset( $base[ $key ]['placeholder'] );
unset( $base[ $key ]['label'] );
if ( version_compare( WC()->version, '4.4.1', '>=' ) ) {
unset( $base[ $key ]['class'] );
}
}Code for line 266 – 269:
if (is_array($locale[ $country ][ $field ])){
unset( $locale[ $country ][ $field ]['priority'] );
unset( $locale[ $country ][ $field ]['label'] );
unset( $locale[ $country ][ $field ]['placeholder'] );
}The page I need help with: [log in to see the link]
- The topic ‘Fatal PHP Error on Cart and Checkout pages’ is closed to new replies.