Skip to main content

How to determine the availability in Magento depending on the stock level

Anyone who uses the Magento stock management knows the problem: As soon as the stock is at 0, Magento automatically sets the availability to "out of stock". Unfortunately, it does not work the other way around: If the stock is replenished, Magento does not automatically set the availability to "in stock".

Now we want to solve this in Excel with the help of the VLOOKUP and the IF function. How to use the VLOOKUP, you can read here.

Example: This time we do not want to maintain the price, but the column Stock, which is searched for in the same way in the matrix.

cobby tries to avoid incorrect entries in many places and does not allow, for example, to enter anything other than "in stock" or "out of stock" in the "Availability" column.

  1. In Excel, for the selection fields, there is initially no way to specify these values by formula, since they are drawn from a named range. Therefore the Validation must be deactivated in Excel now: Data -> Data validation

(Please note: This deactivation is actually only for experienced Excel and cobby users).

  1. First we note the possible values so that we can put them into the formula depending on our condition. In our case these are the values "in stock" and "out of stock".

  2. Then we allow Excel to also contain data in selection fields that is not present in the list. Here we set the selection from "List" to "Any value ".

  1. Now we create the IF function: =IF(VALUE([@stock])>0; "in stock"; "out of stock"). The cell with the formula must have the Standard formatting.

  1. After saving the changes are present in Magento and the availability is displayed correctly depending on the stock.