operate my_get_stock_status() {
$post_id = get_the_ID();
$inventory = get_post_meta($post_id, "_stock_status", true);
return $inventory;
}
The code above works to test the standing of the product, nonetheless if the product has variations, and “any of the variations” are in-stock, then the inventory standing for the product is seen as in-stock, even when one of many different variations are out-of-stock.
I am making an attempt to change this snippet to as a substitute, test the inventory standing of the chosen variable on the entrance finish.
Or if thats not fully doable, then i wish to modify it to test the inventory standing of a specified attribute throughout the product, for instance if I might specify “Blue” because the variation I wish to test towards, this could work for me too.