BOM - same item, brand difference

In manufacturing and creating BOM, we assume that the items are:

  • Rice, brand A
  • Oil, brand B

I don’t care about the brands, I care about the lowest price, I change purchases a lot.
The items are changing, what is the solution? I want it to be automatic. If the item is not available, it automatically selects the alternative item.