<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: WooCommerce: Add Custom Field on Checkout Based on Product Quantity in Cart	</title>
	<atom:link href="https://wasimsama.com/woocommerce-dynamic-custom-field-on-checkout-based-on-product-quantity-in-cart/feed/" rel="self" type="application/rss+xml" />
	<link>https://wasimsama.com/woocommerce-dynamic-custom-field-on-checkout-based-on-product-quantity-in-cart/</link>
	<description>A Passionate Blogger and Web Developer</description>
	<lastBuildDate>Wed, 11 Mar 2020 09:19:21 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>
		By: Morgane		</title>
		<link>https://wasimsama.com/woocommerce-dynamic-custom-field-on-checkout-based-on-product-quantity-in-cart/#comment-64</link>

		<dc:creator><![CDATA[Morgane]]></dc:creator>
		<pubDate>Wed, 11 Mar 2020 09:19:21 +0000</pubDate>
		<guid isPermaLink="false">https://wasimsama.com/?p=1875#comment-64</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://wasimsama.com/woocommerce-dynamic-custom-field-on-checkout-based-on-product-quantity-in-cart/#comment-63&quot;&gt;Guillaume&lt;/a&gt;.

Got the exact same issue, would be super nice if you could help with that part !
Thank you]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://wasimsama.com/woocommerce-dynamic-custom-field-on-checkout-based-on-product-quantity-in-cart/#comment-63">Guillaume</a>.</p>
<p>Got the exact same issue, would be super nice if you could help with that part !<br />
Thank you</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Guillaume		</title>
		<link>https://wasimsama.com/woocommerce-dynamic-custom-field-on-checkout-based-on-product-quantity-in-cart/#comment-63</link>

		<dc:creator><![CDATA[Guillaume]]></dc:creator>
		<pubDate>Fri, 31 Jan 2020 10:01:15 +0000</pubDate>
		<guid isPermaLink="false">https://wasimsama.com/?p=1875#comment-63</guid>

					<description><![CDATA[Hi Wasim, 
thank you for your work, I was looking for this kind of code for a long time. 
I have a little problem, I receive informations on emails, it&#039;s perfect but I can&#039;t retrieve the informations on admin order. I don&#039;t have any informations about this fields.
If you can help me with that. 
I really thank you.]]></description>
			<content:encoded><![CDATA[<p>Hi Wasim,<br />
thank you for your work, I was looking for this kind of code for a long time.<br />
I have a little problem, I receive informations on emails, it&#8217;s perfect but I can&#8217;t retrieve the informations on admin order. I don&#8217;t have any informations about this fields.<br />
If you can help me with that.<br />
I really thank you.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Hitaxi		</title>
		<link>https://wasimsama.com/woocommerce-dynamic-custom-field-on-checkout-based-on-product-quantity-in-cart/#comment-62</link>

		<dc:creator><![CDATA[Hitaxi]]></dc:creator>
		<pubDate>Tue, 24 Dec 2019 04:18:05 +0000</pubDate>
		<guid isPermaLink="false">https://wasimsama.com/?p=1875#comment-62</guid>

					<description><![CDATA[&lt;a href=&quot;https://wordpress.org/plugins/min-and-max-quantity-rule-for-woocommerce/&quot; rel=&quot;nofollow ugc&quot;&gt;Min/Max Quantities Woocommerce&lt;/a&gt;  if you want to give minimum and maximum input limit for cart that you can be setup for it so vendor can be maintain stock good way]]></description>
			<content:encoded><![CDATA[<p><a href="https://wordpress.org/plugins/min-and-max-quantity-rule-for-woocommerce/" rel="nofollow ugc">Min/Max Quantities Woocommerce</a>  if you want to give minimum and maximum input limit for cart that you can be setup for it so vendor can be maintain stock good way</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Adam Marshall		</title>
		<link>https://wasimsama.com/woocommerce-dynamic-custom-field-on-checkout-based-on-product-quantity-in-cart/#comment-61</link>

		<dc:creator><![CDATA[Adam Marshall]]></dc:creator>
		<pubDate>Tue, 10 Sep 2019 08:35:49 +0000</pubDate>
		<guid isPermaLink="false">https://wasimsama.com/?p=1875#comment-61</guid>

					<description><![CDATA[Hi there. This is exactly what I was looking for, thanks so much for sharing. 
All working as expected apart from the additional fields are not showing on the order admin page. They show on the checkout and emails, just not inside the order detail page. Any ideas why this may be the case?
Thanks again,]]></description>
			<content:encoded><![CDATA[<p>Hi there. This is exactly what I was looking for, thanks so much for sharing.<br />
All working as expected apart from the additional fields are not showing on the order admin page. They show on the checkout and emails, just not inside the order detail page. Any ideas why this may be the case?<br />
Thanks again,</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Edwin		</title>
		<link>https://wasimsama.com/woocommerce-dynamic-custom-field-on-checkout-based-on-product-quantity-in-cart/#comment-59</link>

		<dc:creator><![CDATA[Edwin]]></dc:creator>
		<pubDate>Sun, 21 Jul 2019 20:05:58 +0000</pubDate>
		<guid isPermaLink="false">https://wasimsama.com/?p=1875#comment-59</guid>

					<description><![CDATA[Hello Wasim, thanks for your great blog post. Is it possible to limit limit this function to particular items in the cart? E.g. I&#039;d like to add this custom field for some product IDs, but not other product IDs. Thanks]]></description>
			<content:encoded><![CDATA[<p>Hello Wasim, thanks for your great blog post. Is it possible to limit limit this function to particular items in the cart? E.g. I&#8217;d like to add this custom field for some product IDs, but not other product IDs. Thanks</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Debbie		</title>
		<link>https://wasimsama.com/woocommerce-dynamic-custom-field-on-checkout-based-on-product-quantity-in-cart/#comment-57</link>

		<dc:creator><![CDATA[Debbie]]></dc:creator>
		<pubDate>Mon, 15 Jul 2019 06:50:58 +0000</pubDate>
		<guid isPermaLink="false">https://wasimsama.com/?p=1875#comment-57</guid>

					<description><![CDATA[Thank you for this code, it helped me a lot!
But for some reason I have encountered an issue showing the data in admin order details page, is there something missing in the code?

Thanks!]]></description>
			<content:encoded><![CDATA[<p>Thank you for this code, it helped me a lot!<br />
But for some reason I have encountered an issue showing the data in admin order details page, is there something missing in the code?</p>
<p>Thanks!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Wasim		</title>
		<link>https://wasimsama.com/woocommerce-dynamic-custom-field-on-checkout-based-on-product-quantity-in-cart/#comment-56</link>

		<dc:creator><![CDATA[Wasim]]></dc:creator>
		<pubDate>Sat, 15 Jun 2019 08:05:47 +0000</pubDate>
		<guid isPermaLink="false">https://wasimsama.com/?p=1875#comment-56</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://wasimsama.com/woocommerce-dynamic-custom-field-on-checkout-based-on-product-quantity-in-cart/#comment-55&quot;&gt;GMACweb&lt;/a&gt;.

You need to add validation for the required field.

For Example:

&lt;pre&gt;
function person_details($checkout) {
    global $woocommerce;
$count = $woocommerce-&gt;cart-&gt;cart_contents_count;
$i = 1;
       for($k=2; $k&lt;= $count; $k++) {
		$i++;
		print (&#039;Please enter details of attendee &#039;.$i);
		woocommerce_form_field( &#039;cstm_full_name&#039;.$i, array(
        	&#039;type&#039;          =&gt; &#039;text&#039;,
        	&#039;class&#039;         =&gt; array(&#039;my-field-class form-row-wide&#039;),
        	&#039;label&#039;         =&gt; __(&#039;Full name&#039;),
        	&#039;placeholder&#039;   =&gt; __(&#039;Enter full name&#039;),
        	&#039;required&#039; =&gt; true,
        	),
        	$checkout-&gt;get_value( &#039;cstm_full_name&#039;.$i ));
       }
}

/**
 * For data validation of the custom field.
 */
add_action(&#039;woocommerce_checkout_process&#039;, &#039;customise_checkout_field_process&#039;);
function customise_checkout_field_process() {
global $woocommerce;
$count = $woocommerce-&gt;cart-&gt;cart_contents_count;
$i = 1;
       for($k=2; $k&lt;= $count; $k++) {
	  $i++;
	  // if the field is set, if not then show an error message.
	  if (!$_POST[&#039;cstm_full_name&#039;.$i]) wc_add_notice(__(&#039;Full name of ATTENDEE &#039;.$i.&#039; is a required field.&#039;) , &#039;error&#039;);
       }	
}
&lt;/pre&gt;]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://wasimsama.com/woocommerce-dynamic-custom-field-on-checkout-based-on-product-quantity-in-cart/#comment-55">GMACweb</a>.</p>
<p>You need to add validation for the required field.</p>
<p>For Example:</p>
<pre>
function person_details($checkout) {
    global $woocommerce;
$count = $woocommerce->cart->cart_contents_count;
$i = 1;
       for($k=2; $k<= $count; $k++) {
		$i++;
		print ('Please enter details of attendee '.$i);
		woocommerce_form_field( 'cstm_full_name'.$i, array(
        	'type'          => 'text',
        	'class'         => array('my-field-class form-row-wide'),
        	'label'         => __('Full name'),
        	'placeholder'   => __('Enter full name'),
        	'required' => true,
        	),
        	$checkout->get_value( 'cstm_full_name'.$i ));
       }
}

/**
 * For data validation of the custom field.
 */
add_action('woocommerce_checkout_process', 'customise_checkout_field_process');
function customise_checkout_field_process() {
global $woocommerce;
$count = $woocommerce->cart->cart_contents_count;
$i = 1;
       for($k=2; $k<= $count; $k++) {
	  $i++;
	  // if the field is set, if not then show an error message.
	  if (!$_POST['cstm_full_name'.$i]) wc_add_notice(__('Full name of ATTENDEE '.$i.' is a required field.') , 'error');
       }	
}
</pre>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: GMACweb		</title>
		<link>https://wasimsama.com/woocommerce-dynamic-custom-field-on-checkout-based-on-product-quantity-in-cart/#comment-55</link>

		<dc:creator><![CDATA[GMACweb]]></dc:creator>
		<pubDate>Fri, 14 Jun 2019 18:20:53 +0000</pubDate>
		<guid isPermaLink="false">https://wasimsama.com/?p=1875#comment-55</guid>

					<description><![CDATA[Hi there.  This works so very well except that although highlighting the fields in the additional inforamtion section after adding the required = true, it will still let the user skip through to checkout.  Any reason why that you can think of?]]></description>
			<content:encoded><![CDATA[<p>Hi there.  This works so very well except that although highlighting the fields in the additional inforamtion section after adding the required = true, it will still let the user skip through to checkout.  Any reason why that you can think of?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: kay		</title>
		<link>https://wasimsama.com/woocommerce-dynamic-custom-field-on-checkout-based-on-product-quantity-in-cart/#comment-54</link>

		<dc:creator><![CDATA[kay]]></dc:creator>
		<pubDate>Sat, 08 Jun 2019 03:14:37 +0000</pubDate>
		<guid isPermaLink="false">https://wasimsama.com/?p=1875#comment-54</guid>

					<description><![CDATA[One more question, IS this how you would add a drop down in this repeater field?

woocommerce_form_field( &#039;participant_gender&#039;.$i, array(
        	&#039;type&#039;          =&#062; &#039;select&#039;,
        	&#039;class&#039;         =&#062; array(&#039;my-field-class form-row-last&#039;),
        	&#039;label&#039;      =&#062; __(&#039;Gender&#039;),
        	&#039;options&#039; = array(
        	                &#039;&#039; =&#062; __( &#039;Select&#039; ),
                            &#039;Male&#039; =&#062; &#039;Male&#039;,
                            &#039;Female&#039; =&#062; &#039;Female&#039;),
                            ),
            $checkout-&#062;get_value( &#039;participant_gender&#039;.$i ));]]></description>
			<content:encoded><![CDATA[<p>One more question, IS this how you would add a drop down in this repeater field?</p>
<p>woocommerce_form_field( &#8216;participant_gender&#8217;.$i, array(<br />
        	&#8216;type&#8217;          =&gt; &#8216;select&#8217;,<br />
        	&#8216;class&#8217;         =&gt; array(&#8216;my-field-class form-row-last&#8217;),<br />
        	&#8216;label&#8217;      =&gt; __(&#8216;Gender&#8217;),<br />
        	&#8216;options&#8217; = array(<br />
        	                &#8221; =&gt; __( &#8216;Select&#8217; ),<br />
                            &#8216;Male&#8217; =&gt; &#8216;Male&#8217;,<br />
                            &#8216;Female&#8217; =&gt; &#8216;Female&#8217;),<br />
                            ),<br />
            $checkout-&gt;get_value( &#8216;participant_gender&#8217;.$i ));</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: kay		</title>
		<link>https://wasimsama.com/woocommerce-dynamic-custom-field-on-checkout-based-on-product-quantity-in-cart/#comment-53</link>

		<dc:creator><![CDATA[kay]]></dc:creator>
		<pubDate>Fri, 07 Jun 2019 21:08:37 +0000</pubDate>
		<guid isPermaLink="false">https://wasimsama.com/?p=1875#comment-53</guid>

					<description><![CDATA[Hi Wasim, not sure if my previous msg went through..Thanks for sharing this code, very helpful! I&#039;d like to see these fields i nhe order form as well, how can I do that?]]></description>
			<content:encoded><![CDATA[<p>Hi Wasim, not sure if my previous msg went through..Thanks for sharing this code, very helpful! I&#8217;d like to see these fields i nhe order form as well, how can I do that?</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
