Showing and hiding out of stock variations woocommerce
<p>We have a unique situation whereby we need to show all variations of a product even if they are out of stock - this is because they are not technically out of stock - just not purchasable online. However, when it comes to purchasing, the dropdown obviously should not show the variations that we have set to out of stock, because they cannot be purchased online.</p>

<p>Allowing them to be selected anyway, then an out os stock message being shown is very clunky and confusing for the user.</p>

<p>Is there a woocommerce function, perhaps to get all variations rather than the default <code>get_available_variations()</code> ?</p>

<p>Currently we have <strong>Hide out of stock items from the catalog</strong> selected, so that they do not appear in the purchase <strong>dropdown</strong>, and then the following for where we need to display the info anyway:
<strong>content-single-product.php (child theme)</strong></p>

<pre><code>&lt;?php

     global $product;

     $variations = $product-&gt;get_available_variations();


        if (!empty($variations)){

            foreach ($variations as $variation) {
                $id = $variation['variation_id'];
                echo $variation['attributes']['attribute_pa_delivery-method'] . '&lt;br&gt;';
                echo $variation['duration'] . '&lt;br&gt;';
                echo $variation['capacity'];

            }

        }

?&gt; 
</code></pre>

<p>The other option of course, is to <strong>uncheck</strong> 'Hide out of stock items from the catalog', and somehow prevent the variation from appearing in the purchase <strong>dropdown</strong> instead.</p>

<p>Thanks in advance.</p>