Title: Conditional Expression &#8211; ExpressionParser error
Last modified: July 11, 2022

---

# Conditional Expression – ExpressionParser error

 *  Resolved [iantomarcello](https://wordpress.org/support/users/iantomarcello/)
 * (@iantomarcello)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/conditional-expression-expressionparser-error/)
 * Hey there.
 * First of all, lovely plugin, thanks for making this available for all of us.
 * Having an issue with Conditional Expression:
    After setting up the logic, at 
   the frontend (customer) side, the total can’t be calculated and got `ExpressionParser:
   Prepared expression has incorrect type.` instead.
 * Here’s the logic:
    if `{width} * {height} > 1000` = `{width} * {height} * {product_price}*
   0.5` else `{width} * {height} * {product_price}`
 * Where `width` and `height` are Number Field type.
 * Whereas using Single Line Formula with `{width} * {height} * {product_price}`
   works.
 * Here’s `debug.log`:
 *     ```
       width = 1
       height = 2
       product_price = 2
       product_weight = 
       product_width = 
       product_height = 
       product_length = 
       product_regular_price = 2
       is_user_logged = 1
       quantity = 1
       PHP Warning:  Array to string conversion in path\to\my\weird\wordpress\wp-content\plugins\wc-kalkulator\src\ExpressionParser.php on line 96
       ```
   
 * Using version `1.3.2`

Viewing 1 replies (of 1 total)

 *  Plugin Author [Krzysztof Piątkowski](https://wordpress.org/support/users/wckalkulator/)
 * (@wckalkulator)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/conditional-expression-expressionparser-error/#post-15814485)
 * Hi, Thanks for reporting that issue. It’s problem with str_replace on array. 
   It works on PHP7.4, but throws an error in PHP8. I will fix that in a short time.

Viewing 1 replies (of 1 total)

The topic ‘Conditional Expression – ExpressionParser error’ is closed to new replies.

 * ![](https://ps.w.org/wc-kalkulator/assets/icon-256x256.gif?rev=2767665)
 * [Product Fields, Addons and Price Calculator for WooCommerce](https://wordpress.org/plugins/wc-kalkulator/)
 * [Support Threads](https://wordpress.org/support/plugin/wc-kalkulator/)
 * [Active Topics](https://wordpress.org/support/plugin/wc-kalkulator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wc-kalkulator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wc-kalkulator/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Krzysztof Piątkowski](https://wordpress.org/support/users/wckalkulator/)
 * Last activity: [3 years, 11 months ago](https://wordpress.org/support/topic/conditional-expression-expressionparser-error/#post-15814485)
 * Status: resolved