{"id":6752622,"date":"2015-11-16T07:22:09","date_gmt":"2015-11-16T07:22:09","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/change-text-of-quantity-html5-validation\/"},"modified":"2016-08-30T20:18:18","modified_gmt":"2016-08-30T20:18:18","slug":"change-text-of-quantity-html5-validation","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/change-text-of-quantity-html5-validation\/","title":{"rendered":"Change text of quantity HTML5 validation."},"content":{"rendered":"<p>Hi there,<br \/>\nI am creating my first onine shop.<br \/>\nI am facing a problem in displaying custom message for quantity validation.<br \/>\nStock quantity is <strong>not<\/strong> showing in product detail page but it is showing in cart page. I have share both pages screenshot below.<br \/>\nProduct Detail: http:\/\/prntscr.com\/93ajnj<br \/>\nCart: http:\/\/prntscr.com\/93ajuk<\/p>\n<p>I have use below code in woocommerce&gt;single-product&gt;add-to-cart&gt;variable.php<\/p>\n<pre><code>&lt;?php foreach ( $attributes as $attribute_name =&gt; $\n&lt;tr&gt;\n   &lt;td class=&quot;label&quot;&gt;&lt;label for=&quot;&lt;?php echo sanitize_title( $attribute_name ); ?&gt;&quot;&gt;&lt;?php echo wc_attribute_label( $attribute_name ); ?&gt;&lt;\/label&gt;&lt;\/td&gt;\n   &lt;td class=&quot;value&quot;&gt;\n       &lt;?php $selected = isset( $_REQUEST[ &#039;attribute_&#039; . sanitize_title( $attribute_name ) ] ) ? wc_clean( $_REQUEST[ &#039;attribute_&#039; . sanitize_title( $attribute_name ) ] ) : $product-&gt;get_variation_default_attribute( $attribute_name ); wc_dropdown_variation_attribute_options( array( &#039;options&#039; =&gt; $options, &#039;attribute&#039; =&gt; $attribute_name, &#039;product&#039; =&gt; $product, &#039;selected&#039; =&gt; $selected ) ); echo end( $attribute_keys ) === $attribute_name ? &#039;&lt;a class=&quot;reset_variations&quot; href=&quot;#&quot;&gt;&#039; . __( &#039;Clear selection&#039;, &#039;woocommerce&#039; ) . &#039;&lt;\/a&gt;&#039; : &#039;&#039;; ?&gt;\n   &lt;\/td&gt;\n&lt;\/tr&gt;\n&lt;?php $variations_ob = ob_get_clean(); $variations_arr[wc_attribute_label($attribute_name)] = $variations_ob; endforeach;\nforeach ($variations_arr as $name =&gt; $ob) { echo str_ireplace(&#039;Choose an option&#039;, &#039;Select &#039;.$name, $ob );\n} ?&gt;<\/code><\/pre>\n<p>Any help in this regards will be highly appreciated. Thanks in advance.<\/p>\n","protected":false},"template":"","class_list":["post-6752622","topic","type-topic","status-publish","hentry","topic-tag-variable-products"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/6752622","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/6752622\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=6752622"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}