• Resolved ady66

    (@ady66)


    Hi,
    in the xml file stock quantity are text values: <availability>In stock</availability>, <availability>In stock at 30th may</availability>, <availability>Out of stock</availability>.

    You could advise what script is needed to make it work for a products where text values <availability>In stock</availability> displayed: “In stock” and for others products with text values:<availability>In stock at 30th may</availability>, <availability>Out of stock</availability> displayed: “Out of stock”. Thank you.

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

    (@wpallimport)

    Hi @ady66

    You can use a custom PHP function to do this: http://www.wpallimport.com/documentation/developers/execute-php/. Example function:

    function my_convert_stock_text( $text ) {
        return ( $text == 'In stock' ) ? 'In stock' : 'Out of stock';
    }

    Called like so:

    [my_convert_stock_text({availability[1]})]

    One thing I should mention, though, is that if you’re importing into the WooCommerce stock field then it requires the text to be either “instock” or “outofstock”.

    Thread Starter ady66

    (@ady66)

    Hi @wpallimport,
    excellent, thank you so much 🙂

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

The topic ‘Stock quantity is text value’ is closed to new replies.