I\'m working on the display of the stock availability on the (individual) product page of my Magento theme, and there\'s something I don\'t completely understand about this.
I see those having semantic differences. An item that is not in stock can still be saleable if said item is set to allow backorders.
As far as I can tell, it looks like isAvailable
checks a product type instance to see if the product type could be for sale if it is indeed available.
So, to venture a guess at when you might choose one over the other:
If you are checking an individual product to see if said product is actually ready for sale, you should use isSalable()
, as it will call isAvailable()
.
To check if a product (whose type you don't know off hand) could be sold, and I suppose skipping the step of checking the product's type, you could call isAvailable()
on the product.
isAvailable()
checks if a product's type is salable.
isSalable()
checks if a product is salable.
isSaleable()
is an alias of isSalable()
.