Variable products with zero prices. Replace price with IF statement
-
Hello,
I am trying to import to woocommerce variable products with wp all import but some variations have zero (0) price so the plugin does not import those variations correctly.
For those cases I want to use main product price instead of variation price.With drag & drop is give me {price[1]} for the main price and {option_price[1]} for variant price when drag from the popup XML tree (or {option_group[1]/option_value[1]/option_price[1]} when drag from mail menu).
I used in the variation price box the statement below but it is not working:
[IF({option_price[.=0]})]{price[1]}[ELSE]{option_price[1]}[ENDIF] Below a product that imports correctly (no zero prices): <product> <product_name>20's 50ml - FYT</product_name> <sku>e22uu-20-0050-00m</sku> <quantity>9947</quantity> <url>https://wxxxx.com/index.php?route=product/product&product_id=1880</url> <url_seo>https://www.ecig.gr/20-s-50ml-fyt.html</url_seo> <category>Liquids</category> <category>Best-Liquids</category> <image>https://xxxx.com/image/data/xxxx/liquid/bestliquid_fgt/20ds-fgt.jpg</image> <price>$16</price> <description> <h3>20's 50ml - FYT</h3> <p class="special1">Some text here</description> <option_group> <option_value> <option_option_description>Grades</option_option_description> <option_option_quantity>9969</option_option_quantity> <option_option_id>52</option_option_id> <option_name>13mg/ml (+8 Grades -105ml)</option_name> <option_subsku></option_subsku> <option_price>$46.8</option_price> </option_value> <option_option_description>Grades</option_option_description> <option_option_quantity>9199</option_option_quantity> <option_option_id>52</option_option_id> <option_name>8mg/ml (+4 Grades -90ml)</option_name> <option_subsku></option_subsku> <option_price>$31.4</option_price> <option_value> <option_option_description>Grades</option_option_description> <option_option_quantity>9439</option_option_quantity> <option_option_id>52</option_option_id> <option_name>9mg/ml (+5 Grades -100ml)</option_name> <option_subsku></option_subsku> <option_price>35.25</option_price> </option_value> </product> And this is not working (zero prices in variants): <product> <product_name>80's</product_name> <sku>e2ff6-ei45</sku> <quantity>6849</quantity> <url>https://xxxx.com/index.php?route=product/product&product_id=8859</url> <url_seo>https://xxxx.com/80d-s.html</url_seo> <category>Liquids</category> <category>Best-Liquids</category> <image>https://xxx.com/image/data/xxxx/liquid/the-best/t80ds.jpg</image> <price>$5.5</price> <description><h3>80's</h3> <p>Some text here 80's</p> <p>Sugar, creme, bourbon, and more</description> <option_group> <option_value> <option_option_description>Size / Content</option_option_description> <option_option_quantity>9799</option_option_quantity> <option_option_id>46</option_option_id> <option_name>10ml - 0mg/ml (0%)</option_name> <option_subsku>-0010-00m</option_subsku> <option_price>$0</option_price> </option_value> <option_value> <option_option_description>Size / Content</option_option_description> <option_option_quantity>9795</option_option_quantity> <option_option_id>46</option_option_id> <option_name>10ml - 6mg/ml (0.6%)</option_name> <option_subsku>-0010-062m</option_subsku> <option_price>$0</option_price> </option_value> <option_value> <option_option_description>Size / Content</option_option_description> <option_option_quantity>9769</option_option_quantity> <option_option_id>46</option_option_id> <option_name>10ml - 12mg/ml (1.2%)</option_name> <option_subsku>-0010-12m</option_subsku> <option_price>$0</option_price> </option_value> </option_group> </product>
Could you please help me on what am I doing wrong?
Thank you.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Variable products with zero prices. Replace price with IF statement’ is closed to new replies.