Move “in stock” up on Woocommerce product page

I’m trying to move “in stock” just underneath the price rather than after the product short description.

What I don’t get is that on my wp-content/plugins/woocommerce/templates/single-product/price.php.

Read More

The code seems to do just that :

<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">

<p class="price"><?php echo $product->get_price_html(); ?></p>

<meta itemprop="price" content="<?php echo esc_attr( $product->get_price() ); ?>" />
<meta itemprop="priceCurrency" content="<?php echo esc_attr( get_woocommerce_currency() ); ?>" />
<link itemprop="availability" href="http://schema.org/<?php echo $product->is_in_stock() ? 'InStock' : 'OutOfStock'; ?>" />

But when I’m on my product page, the description somehow comes in between :
http://www.taldeak.fr/shop/rugby/pays-de-galles-france-cardiff-26-28-fevrier-2016

I know it’s in French but basically price and stock are the only two infos in green. FYI, I’m using the WooCommerce – Gravity Forms Product Add-Ons, in case it’s relevant.

If anyone could help, it would be great !!
Thanks in advance,
G

Related posts

1 comment

  1. You have moved your link tag for the itemprop="availablity", which is showing in the html within the itemprop="offers" however you have not moved the actual stock html that is contained within <p class="stock in-stock">

    This is the current content around the code you provided

    <div itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
        <p class="price"><span class="woocommerce-price-before"><font><font>from € 849 </font></font></span><span class="woocommerce-price-after"> </span></p>
    <meta itemprop="price" content="0">
        <meta itemprop="priceCurrency" content="EUR">
        <link itemprop="availability" href="http://schema.org/InStock">
    </div>
    

    Edit: The stock status is included in two places, depending on whether it is a simple or grouped product:

    wp-content/plugins/woocommerce/templates/single-product/add-to-cart/simple.php line 22

    <?php
        // Availability
        $availability      = $product->get_availability();
        $availability_html = empty( $availability['availability'] ) ? '' : '<p class="stock ' . esc_attr( $availability['class'] ) . '">' . esc_html( $availability['availability'] ) . '</p>';
    
        echo apply_filters( 'woocommerce_stock_html', $availability_html, $availability['availability'], $product );
    ?>
    

    wp-content/plugins/woocommerce/templates/single-product/add-to-cart/grouped.php line 62

    <?php
        echo $product->get_price_html();
    
        if ( $availability = $product->get_availability() ) {
            $availability_html = empty( $availability['availability'] ) ? '' : '<p class="stock ' . esc_attr( $availability['class'] ) . '">' . esc_html( $availability['availability'] ) . '</p>';
            echo apply_filters( 'woocommerce_stock_html', $availability_html, $availability['availability'], $product );
        }
    ?>
    

Comments are closed.