Title: Compare 2 fields with inline PHP
Last modified: March 17, 2022

---

# Compare 2 fields with inline PHP

 *  Resolved [thvx](https://wordpress.org/support/users/thvx/)
 * (@thvx)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/compare-2-fields-with-inline-php/)
 * I am currently importing a CSV file into my WooCommerce products. I’m trying 
   to make it so that the sale price on products only gets showcased when {price[
   1]} is less then {fromprice[1]}. For this, I’ve put a inline PHP if-statement
   in the WooCommerce add-on sale price section, but it doesn’t work. Code:
 *     ```
       [IF({price[.< {fromprice}]}) ] {price} [ENDIF]
       ```
   
 * Whenever I click on preview it gives me the following error: Error parsing: Close
   brace expected instead of TEXT
 * I really want to continue importing, any help would be greatly appreciated!
    -  This topic was modified 4 years, 2 months ago by [thvx](https://wordpress.org/support/users/thvx/).
    -  This topic was modified 4 years, 2 months ago by [thvx](https://wordpress.org/support/users/thvx/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/compare-2-fields-with-inline-php/#post-15484480)
 * Hey [@thvx](https://wordpress.org/support/users/thvx/),
 * Please try this syntax instead:
 * `[IF({price[.<../fromprice]})]{price}[ENDIF]`
 * Let me know how it goes.
 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [4 years ago](https://wordpress.org/support/topic/compare-2-fields-with-inline-php/#post-15604227)
 * Hey [@thvx](https://wordpress.org/support/users/thvx/),
 * I’m marking this as resolved since it’s been inactive for a while now. Please
   open a new topic if you still have questions.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Compare 2 fields with inline PHP’ is closed to new replies.

 * ![](https://ps.w.org/wp-all-import/assets/icon-256x256.png?rev=2570179)
 * [WP All Import – Drag & Drop Import for CSV, XML, Excel & Google Sheets](https://wordpress.org/plugins/wp-all-import/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-all-import/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-all-import/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-all-import/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-all-import/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-all-import/reviews/)

## Tags

 * [all import](https://wordpress.org/support/topic-tag/all-import/)
 * [Import](https://wordpress.org/support/topic-tag/import/)

 * 2 replies
 * 2 participants
 * Last reply from: [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * Last activity: [4 years ago](https://wordpress.org/support/topic/compare-2-fields-with-inline-php/#post-15604227)
 * Status: resolved