• Resolved negativzje

    (@negativzje)


    Dear Support,

    I have a CSV file in which the stock status is indicated by 0, 1, and 2. The values represent the following: 0 = out of stock, 1 = low stock, 2 = in stock.

    I don’t manage stock quantities on the website; it’s not enabled. I added the low stock status to WooCommerce with a custom code to display the stock status accordingly.

    How can I ensure that WPA updates the stock status based on this? The CSV includes a field named “stock status” that contains the values 0, 1, or 2. I tried to link my CSV field in the “Set with XPath” during import, but no changes occurred.

    Thanks,
    neg.

Viewing 1 replies (of 1 total)
  • Plugin Author WP All Import

    (@wpallimport)

    Hi @negativzje,

    You can use an XPath IF statement for this. For example, if you want “0” to be “outofstock”, “1” to be “onbackorder”, and everything else to be “instock”, you could use this (change “stock” in the IFs to the name of your XPath element):

    [IF({stock[1][.="0"]})]outofstock[ELSEIF({stock[1][.="1"]})]onbackorder[ELSE]instock[ENDIF]

    Or, if you want anything above 1 to be “instock”, you could use this:

    [IF({stock[1][.>1]})]instock[ELSE]outofstock[ENDIF]

    These would be used in the “Set with XPath” option for the stock status field.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.