• I have set 3 variables of size (S | M | L)
    After I change the stock quantity of variable S to 0 (i.e. out of stock), normally, the variable S button would become disabled:
    <input type=”radio” name=”attribute_size” value=”S” id=”size_v_S” disabled=”disabled”>
    So the S size button is still visible and I can grey out the button.
    But somehow, of some products (not every product), the variable S’s radio button is missing.
    I want to add the code: <input type=”radio” name=”attribute_size” value=”S” id=”size_v_S” disabled=”disabled”> back to my product page, please teach me how. (I tried modified your variable.php, but still have no clue.)
    Thanks a lot.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author mantish

    (@mantish)

    Hi,
    Can you figure out in which products the radio button is missing?

    Thread Starter ive6830

    (@ive6830)

    Hi, mantish. Thanks for your reply.
    I tried to test where the problem is by deactivating all my plugins (except WooCommerce) and switching to default Twenty Fifteen theme.
    But it’s still wrong (only show size L but missing S and M).
    So I’m not sure is it a WooCommerce’s bug or something I did wrong.
    And I found out a strange thing, this situation seems appears after I change the quantity of the product variable at WP Product Backstage Settings. But if the product is checkout and automatically set to “out out stock” status, the variable didn’t disappear.
    Another strange thing is that I tried to delete the product with this issue, and create a new product, it works fine at first. But after I change the new product’s SKU number and address URL to the same as the wrong product’s SKU and address URL, it gets wrong again.
    Do you have any other idea about how to find out where the problem is?
    Thanks.

    Plugin Author mantish

    (@mantish)

    That’s very weird, do you have your site online? maybe I can take a look

    Thread Starter ive6830

    (@ive6830)

    I run my website on localhost now, if you don’t mind here is my code of single product’s variations:
    (I created a new product, and set variable S to 0 quantity, and it’s disappeared. I think the problem is that when I set the variable S to 0 quantity at WP backstage, it automatically regard as there is no variable S, so it didn’t show S in the front)

    <form class=”variations_form cart” method=”post” enctype=”multipart/form-data” data-product_id=”1066″ data-product_variations=”[{"variation_id":1069,"variation_is_visible":false,"variation_is_active":true,"is_purchasable":false,"display_price":0,"display_regular_price":0,"attributes":{"attribute_size":"L"},"image_src":"","image_link":"","image_title":"","image_alt":"","image_caption":"","image_srcset":"","image_sizes":"","price_html":"<span class=\"price\"><\/span>","availability_html":"<p class=\"stock out-of-stock\">This item is not available at this time due to pending orders.<\/p>","sku":"12345","weight":" kg","dimensions":"","min_qty":1,"max_qty":null,"backorders_allowed":false,"is_in_stock":false,"is_downloadable":false,"is_virtual":false,"is_sold_individually":"no","variation_description":""},{"variation_id":1070,"variation_is_visible":false,"variation_is_active":true,"is_purchasable":false,"display_price":0,"display_regular_price":0,"attributes":{"attribute_size":"M"},"image_src":"","image_link":"","image_title":"","image_alt":"","image_caption":"","image_srcset":"","image_sizes":"","price_html":"<span class=\"price\"><\/span>","availability_html":"<p class=\"stock out-of-stock\">This item is not available at this time due to pending orders.<\/p>","sku":"12345","weight":" kg","dimensions":"","min_qty":1,"max_qty":null,"backorders_allowed":false,"is_in_stock":false,"is_downloadable":false,"is_virtual":false,"is_sold_individually":"no","variation_description":""}]”>
    <table class=”variations” cellspacing=”0″>
    <tbody>
    <tr>
    <td class=”value”>
    <div><input type=”radio” name=”attribute_size” value=”M” id=”size_v_M”><label for=”size_v_M”>M</label></div><div><input type=”radio” name=”attribute_size” value=”L” id=”size_v_L”><label for=”size_v_L”>L</label></div>clear </td>
    </tr>
    </tbody>
    </table>
    <div class=”single_variation_wrap”>
    <div class=”woocommerce-variation single_variation” style=”display: none;”></div><div class=”woocommerce-variation-add-to-cart variations_button woocommerce-variation-add-to-cart-disabled”>
    <div class=”quantity”>
    <input type=”number” step=”1″ min=”” max=”” name=”quantity” value=”1″ title=”quantity” class=”input-text qty text” size=”4″ pattern=”[0-9]*” inputmode=”numeric”>
    </div>
    <button type=”submit” class=”single_add_to_cart_button button alt disabled wc-variation-selection-needed”>Add To Cart</button>
    <input type=”hidden” name=”add-to-cart” value=”1066″>
    <input type=”hidden” name=”product_id” value=”1066″>
    <input type=”hidden” name=”variation_id” class=”variation_id” value=””>
    </div>
    </div>
    </form>

    • This reply was modified 8 years, 3 months ago by ive6830.
    Plugin Author mantish

    (@mantish)

    I don’t think it’s a bug, but the only thing that comes to mind is the Out Of Stock Visibility setting for WooCommerce

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Sold out variable missing’ is closed to new replies.