• Resolved egyufo

    (@egyufo)


    Hello!

    I need to import a feed, where the stock status is like this:

    0=Out of stock
    1=Low stock
    3=Instock

    I want to use custom stock statuses in WooCommerce but I have to rewrite this data like 0,1,3 to the custom statuses

    Can you help me?

    Thanks!

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

    (@wpallimport)

    Hi @egyufo,

    I want to use custom stock statuses in WooCommerce but I have to rewrite this data like 0,1,3 to the custom statuses

    Are you needing to convert the numbers to stock statuses? If so, you can use a PHP function to do it: https://www.wpallimport.com/documentation/developers/custom-code/inline-php/.

    For example:

    [str_replace(array(0,1,3),array("outofstock","instock","instock"),{stock[1]})]

    Just replace {stock[1]} with the correct import element from your file.

    hithunters

    (@hithunters)

    @wpallimport
    After i sent a support request on your website i saw this forumpost which is kinda the same as i am facing.

    I need to import a feed, where the stock status is like this:

    0=Out of stock
    1=Instock

    I tried custom fields stock status with mapping instock to 1 and outofstock to 2 but somehow because of that it also started showing out of stock products in the shop. Also i am confused of how to set the other settings to make sure everything runs smooth.

    hithunters

    (@hithunters)

    @wpallimport
    Update: it works now with the example you gave above. I just cut out option 3 and the double instock. so i got this:
    [str_replace(array(0,1),array(“outofstock”,”instock”),{stock[1]})]

    And pasted it in the xpath for stock status. Many thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Stock value rewrite’ is closed to new replies.