• Resolved nicoter

    (@nicoter)


    There’s an option to set the tax class with xpath, see https://i.imgur.com/M46G3yU.png
    The correct values are either ‘standard’ or ‘reduced-tax’.

    The CSV feed contains a field named ‘mwst’ with the value ’31’ or ’32’.

    Now when the value in the CSV is 31 I need the tax class to be set to standard and when the value is 32 it needs to be reduced-tax.

    How can I do this with Xpath? It would be easy for me to achieve this with a custom function which returns the correct string, but with Xpath I’m stuck.

    Thanks

    PS: Btw I have the paid version (ultimate pro package) but I’m posting it here so others can find the solution in the future. There’s literally no examples or solutions on the web and in your documentation regarding advanced Xpath settings ??

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

    (@wpallimport)

    Hi @nicoter,

    The XPath IF statement would look something like this (I made “standard” the default for all values other than 31 and 32):

    [IF({mswt[1][.="31"]})]standard[ELSEIF({mswt[1][.="32"]})]reduced-rate[ELSE]standard[ENDIF]

    We don’t have documentation on XPath IF statements because we don’t really recommend using them given how confusing and complex they can be. If it’s at all possible, we recommend using PHP since it’s much easier than XPath.

    Plugin Author WP All Import

    (@wpallimport)

    Hi @nicoter,

    I’m marking this as resolved since it’s been inactive for a while. Please feel free to open a new topic if you still have questions.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Select tax class with Xpath (Woocommerce)’ is closed to new replies.