<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>Just A Bill</title>
	<atom:link href="https://justabill.blog/feed/" rel="self" type="application/rss+xml" />
	<link>https://justabill.blog</link>
	<description>Making The World Better With WooCommerce</description>
	<lastBuildDate>Sun, 19 Sep 2021 15:33:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://i2.wp.com/justabill.blog/wp-content/uploads/2018/10/3-sons-favicon.png?fit=32%2C32&#038;ssl=1</url>
	<title>Just A Bill</title>
	<link>https://justabill.blog</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">152986657</site>	<item>
		<title>Simplifying Stock Management with Variable Products in WooCommerce</title>
		<link>https://justabill.blog/simplifying-stock-management-with-variable-products-in-woocommerce/</link>
					<comments>https://justabill.blog/simplifying-stock-management-with-variable-products-in-woocommerce/#respond</comments>
		
		<dc:creator><![CDATA[Bill Robbins]]></dc:creator>
		<pubDate>Fri, 17 Sep 2021 21:48:32 +0000</pubDate>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[WooCommerce]]></category>
		<guid isPermaLink="false">https://justabill.blog/?p=26309</guid>

					<description><![CDATA[Managing stock for a store can be a very time consuming process so any way we can speed that up &#8230; <a href="https://justabill.blog/simplifying-stock-management-with-variable-products-in-woocommerce/" class="read-more">Continue Reading <span class="screen-reader-text">Simplifying Stock Management with Variable Products in WooCommerce</span></a>]]></description>
										<content:encoded><![CDATA[
<p>Managing stock for a store can be a very time consuming process so any way we can speed that up is great for business.  Recently I was helping out a merchant who had this idea for how to simplify managing stock with their variable products.  </p>



<p>Instead of creating a variation for every possible attribute combination on a product, they created one variation for the &#8220;any&#8221; of each attribute.  They add a price to the variation and set it to be in stock.  This sets the &#8220;default&#8221; state for our product.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1020" height="759" src="https://i1.wp.com/justabill.blog/wp-content/uploads/2021/09/any-variation.png?resize=1020%2C759&#038;ssl=1" alt="" class="wp-image-26313" srcset="https://i1.wp.com/justabill.blog/wp-content/uploads/2021/09/any-variation.png?resize=1024%2C762&amp;ssl=1 1024w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/09/any-variation.png?resize=300%2C223&amp;ssl=1 300w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/09/any-variation.png?resize=768%2C572&amp;ssl=1 768w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/09/any-variation.png?resize=1536%2C1144&amp;ssl=1 1536w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/09/any-variation.png?resize=600%2C447&amp;ssl=1 600w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/09/any-variation.png?resize=1200%2C893&amp;ssl=1 1200w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/09/any-variation.png?w=1832&amp;ssl=1 1832w" sizes="(max-width: 1020px) 100vw, 1020px" data-recalc-dims="1" /></figure>



<p>Now when one of their variations goes out of stock, they create a variation for it.   They enable the &#8220;manage stock&#8221; option and set the stock quantity to 0.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1020" height="666" src="https://i1.wp.com/justabill.blog/wp-content/uploads/2021/09/out-of-stock-variation-11.42.34-AM.png?resize=1020%2C666&#038;ssl=1" alt="" class="wp-image-26315" srcset="https://i1.wp.com/justabill.blog/wp-content/uploads/2021/09/out-of-stock-variation-11.42.34-AM.png?resize=1024%2C669&amp;ssl=1 1024w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/09/out-of-stock-variation-11.42.34-AM.png?resize=300%2C196&amp;ssl=1 300w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/09/out-of-stock-variation-11.42.34-AM.png?resize=768%2C502&amp;ssl=1 768w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/09/out-of-stock-variation-11.42.34-AM.png?resize=1536%2C1003&amp;ssl=1 1536w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/09/out-of-stock-variation-11.42.34-AM.png?resize=600%2C392&amp;ssl=1 600w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/09/out-of-stock-variation-11.42.34-AM.png?resize=1200%2C784&amp;ssl=1 1200w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/09/out-of-stock-variation-11.42.34-AM.png?w=1828&amp;ssl=1 1828w" sizes="(max-width: 1020px) 100vw, 1020px" data-recalc-dims="1" /></figure>



<p>Now when customers go to this product, they can purchase any of the attributes except for the one they just created.  When that combination is available again, they can remove it from the product or set it to be in stock again.</p>



<p>One catch I discovered is this currently only works when the option to hide out of stock items is disabled.  When that is enabled, this currently does not work.  There&#8217;s an <a href="https://github.com/woocommerce/woocommerce/issues/30732">open issue</a> about this.  </p>



<p>This is not an option for all stores but it could make inventory management easier for some stores so I wanted to make sure to share it.  </p>



<p>Let me know if you have any questions in the comments.  </p>
]]></content:encoded>
					
					<wfw:commentRss>https://justabill.blog/simplifying-stock-management-with-variable-products-in-woocommerce/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">26309</post-id>	</item>
		<item>
		<title>How To Disable Specific Flat Rate Boxes in the WooCommerce USPS Shipping Method</title>
		<link>https://justabill.blog/how-to-disable-specific-flat-rate-boxes-in-the-woocommerce-usps-shipping-method/</link>
					<comments>https://justabill.blog/how-to-disable-specific-flat-rate-boxes-in-the-woocommerce-usps-shipping-method/#respond</comments>
		
		<dc:creator><![CDATA[Bill Robbins]]></dc:creator>
		<pubDate>Tue, 31 Aug 2021 18:10:46 +0000</pubDate>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[WooCommerce]]></category>
		<category><![CDATA[Shipping]]></category>
		<guid isPermaLink="false">https://justabill.blog/?p=26229</guid>

					<description><![CDATA[Out of the box, WooCommerce includes a large number of flat rate boxes in the USPS Shipping Method extension. The &#8230; <a href="https://justabill.blog/how-to-disable-specific-flat-rate-boxes-in-the-woocommerce-usps-shipping-method/" class="read-more">Continue Reading <span class="screen-reader-text">How To Disable Specific Flat Rate Boxes in the WooCommerce USPS Shipping Method</span></a>]]></description>
										<content:encoded><![CDATA[
<p>Out of the box, WooCommerce includes a large number of flat rate boxes in the USPS Shipping Method extension.  The only problem is your store may not stock or use some of these.  It is possible to change the set of boxes that the extension uses with a filter.  Here&#8217;s how.</p>



<p>Add this snippet to your site either in the theme&#8217;s functions.php file or with the Code Snippets plugin.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
function ijab_usps_flat_rate_boxes( $boxes ) {
	
	$boxes = &#91;];
	
	$boxes = 	array(
		// Priority Mail Express.
		'd13'  =&gt; array(
			'id'       =&gt; 'FLAT RATE ENVELOPE',
			'name'     =&gt; 'Priority Mail Express Flat Rate Envelope',
			'length'   =&gt; '12.5',
			'width'    =&gt; '9.5',
			'height'   =&gt; '0.5',
			'weight'   =&gt; '70',
			'type'     =&gt; 'envelope',
			'box_type' =&gt; 'express',
		),
		'd30'  =&gt; array(
			'id'       =&gt; 'LEGAL FLAT RATE ENVELOPE',
			'name'     =&gt; 'Priority Mail Express Legal Flat Rate Envelope',
			'length'   =&gt; '9.5',
			'width'    =&gt; '15',
			'height'   =&gt; '0.5',
			'weight'   =&gt; '70',
			'type'     =&gt; 'envelope',
			'box_type' =&gt; 'express',
		),
		'd63'  =&gt; array(
			'id'       =&gt; 'PADDED FLAT RATE ENVELOPE',
			'name'     =&gt; 'Priority Mail Express Padded Flat Rate Envelope',
			'length'   =&gt; '12.5',
			'width'    =&gt; '9.5',
			'height'   =&gt; '0.5',
			'weight'   =&gt; '70',
			'type'     =&gt; 'envelope',
			'box_type' =&gt; 'express',
		),

		// Priority Mail.
		'd16'  =&gt; array(
			'id'       =&gt; 'FLAT RATE ENVELOPE',
			'name'     =&gt; 'Priority Mail Flat Rate Envelope',
			'length'   =&gt; '12.5',
			'width'    =&gt; '9.5',
			'height'   =&gt; '0.5',
			'weight'   =&gt; '70',
			'type'     =&gt; 'envelope',
			'box_type' =&gt; 'priority',
		),
		'd17'  =&gt; array(
			'id'       =&gt; 'MD FLAT RATE BOX',
			'name'     =&gt; 'Priority Mail Flat Rate Medium Box - 2',
			'length'   =&gt; '13.625',
			'width'    =&gt; '11.875',
			'height'   =&gt; '3.375',
			'weight'   =&gt; '70',
			'box_type' =&gt; 'priority',
		),
		'd17b' =&gt; array(
			'id'       =&gt; 'MD FLAT RATE BOX',
			'name'     =&gt; 'Priority Mail Flat Rate Medium Box - 1',
			'length'   =&gt; '11',
			'width'    =&gt; '8.5',
			'height'   =&gt; '5.5',
			'weight'   =&gt; '70',
			'box_type' =&gt; 'priority',
		),
		'd22'  =&gt; array(
			'id'       =&gt; 'LG FLAT RATE BOX',
			'name'     =&gt; 'Priority Mail Flat Rate Large Box',
			'length'   =&gt; '12',
			'width'    =&gt; '12',
			'height'   =&gt; '5.5',
			'weight'   =&gt; '70',
			'box_type' =&gt; 'priority',
		),
		'd22a' =&gt; array(
			'id'       =&gt; 'LG FLAT RATE BOX',
			'name'     =&gt; 'Priority Mail Large Flat Rate Board Game Box',
			'length'   =&gt; '23.69',
			'width'    =&gt; '11.75',
			'height'   =&gt; '3',
			'weight'   =&gt; '70',
			'box_type' =&gt; 'priority',
		),
		'd28'  =&gt; array(
			'id'       =&gt; 'SM FLAT RATE BOX',
			'name'     =&gt; 'Priority Mail Flat Rate Small Box',
			'length'   =&gt; '5.375',
			'width'    =&gt; '8.625',
			'height'   =&gt; '1.625',
			'weight'   =&gt; '70',
			'box_type' =&gt; 'priority',
		),
		'd29'  =&gt; array(
			'id'       =&gt; 'PADDED FLAT RATE ENVELOPE',
			'name'     =&gt; 'Priority Mail Padded Flat Rate Envelope',
			'length'   =&gt; '12.5',
			'width'    =&gt; '9.5',
			'height'   =&gt; '0.5',
			'weight'   =&gt; '70',
			'type'     =&gt; 'envelope',
			'box_type' =&gt; 'priority',
		),
		'd38'  =&gt; array(
			'id'       =&gt; 'GIFT CARD FLAT RATE ENVELOPE',
			'name'     =&gt; 'Priority Mail Gift Card Flat Rate Envelope',
			'length'   =&gt; '10',
			'width'    =&gt; '7',
			'height'   =&gt; '0.5',
			'weight'   =&gt; '70',
			'type'     =&gt; 'envelope',
			'box_type' =&gt; 'priority',
		),
		'd40'  =&gt; array(
			'id'       =&gt; 'WINDOW FLAT RATE ENVELOPE',
			'name'     =&gt; 'Priority Mail Window Flat Rate Envelope',
			'length'   =&gt; '5',
			'width'    =&gt; '10',
			'height'   =&gt; '0.25',
			'weight'   =&gt; '70',
			'type'     =&gt; 'envelope',
			'box_type' =&gt; 'priority',
		),
		'd42'  =&gt; array(
			'id'       =&gt; 'SM FLAT RATE ENVELOPE',
			'name'     =&gt; 'Priority Mail Small Flat Rate Envelope',
			'length'   =&gt; '6',
			'width'    =&gt; '10',
			'height'   =&gt; '0.5',
			'weight'   =&gt; '70',
			'type'     =&gt; 'envelope',
			'box_type' =&gt; 'priority',
		),
		'd44'  =&gt; array(
			'id'       =&gt; 'LEGAL FLAT RATE ENVELOPE',
			'name'     =&gt; 'Priority Mail Legal Flat Rate Envelope',
			'length'   =&gt; '9.5',
			'width'    =&gt; '15',
			'height'   =&gt; '0.5',
			'weight'   =&gt; '70',
			'type'     =&gt; 'envelope',
			'box_type' =&gt; 'priority',
		),

		// International Priority Mail Express.
		'i13'  =&gt; array(
			'id'       =&gt; '10',
			'name'     =&gt; 'Priority Mail Express Flat Rate Envelope',
			'length'   =&gt; '12.5',
			'width'    =&gt; '9.5',
			'height'   =&gt; '0.5',
			'weight'   =&gt; '4',
			'type'     =&gt; 'envelope',
			'box_type' =&gt; 'express',
		),
		'i30'  =&gt; array(
			'id'       =&gt; '17',
			'name'     =&gt; 'Priority Mail Express Legal Flat Rate Envelope',
			'length'   =&gt; '9.5',
			'width'    =&gt; '15',
			'height'   =&gt; '0.5',
			'weight'   =&gt; '4',
			'type'     =&gt; 'envelope',
			'box_type' =&gt; 'express',
		),
		'i63'  =&gt; array(
			'id'       =&gt; '27',
			'name'     =&gt; 'Priority Mail Express Padded Flat Rate Envelope',
			'length'   =&gt; '12.5',
			'width'    =&gt; '9.5',
			'height'   =&gt; '0.5',
			'weight'   =&gt; '4',
			'type'     =&gt; 'envelope',
			'box_type' =&gt; 'express',
		),

		// International Priority Mail.
		'i8'   =&gt; array(
			'id'       =&gt; '8',
			'name'     =&gt; 'Priority Mail Flat Rate Envelope',
			'length'   =&gt; '12.5',
			'width'    =&gt; '9.5',
			'height'   =&gt; '0.5',
			'weight'   =&gt; '4',
			'type'     =&gt; 'envelope',
			'box_type' =&gt; 'priority',
		),
		'i29'  =&gt; array(
			'id'       =&gt; '23',
			'name'     =&gt; 'Priority Mail Padded Flat Rate Envelope',
			'length'   =&gt; '12.5',
			'width'    =&gt; '9.5',
			'height'   =&gt; '0.5',
			'weight'   =&gt; '4',
			'type'     =&gt; 'envelope',
			'box_type' =&gt; 'priority',
		),
		'i16'  =&gt; array(
			'id'       =&gt; '16',
			'name'     =&gt; 'Priority Mail Flat Rate Small Box',
			'length'   =&gt; '5.375',
			'width'    =&gt; '8.625',
			'height'   =&gt; '1.625',
			'weight'   =&gt; '4',
			'box_type' =&gt; 'priority',
		),
		'i9'   =&gt; array(
			'id'       =&gt; '9',
			'name'     =&gt; 'Priority Mail Flat Rate Medium Box',
			'length'   =&gt; '13.625',
			'width'    =&gt; '11.875',
			'height'   =&gt; '3.375',
			'weight'   =&gt; '20',
			'box_type' =&gt; 'priority',
		),
		'i9b'  =&gt; array(
			'id'       =&gt; '9',
			'name'     =&gt; 'Priority Mail Flat Rate Medium Box',
			'length'   =&gt; '11',
			'width'    =&gt; '8.5',
			'height'   =&gt; '5.5',
			'weight'   =&gt; '70',
			'box_type' =&gt; 'priority',
		),
		'i11'  =&gt; array(
			'id'       =&gt; '11',
			'name'     =&gt; 'Priority Mail Flat Rate Large Box',
			'length'   =&gt; '12',
			'width'    =&gt; '12',
			'height'   =&gt; '5.5',
			'weight'   =&gt; '20',
			'box_type' =&gt; 'priority',
		),
		'i11a' =&gt; array(
			'id'       =&gt; '11',
			'name'     =&gt; 'Priority Mail Large Flat Rate Board Game Box',
			'length'   =&gt; '23.69',
			'width'    =&gt; '11.75',
			'height'   =&gt; '3',
			'weight'   =&gt; '70',
			'box_type' =&gt; 'priority',
		),
	);

	return $boxes;
}
add_filter( 'wc_usps_flat_rate_boxes', 'ijab_usps_flat_rate_boxes' );
</pre></div>


<p>That copies the list of packages directly from the extension.  Now you can remove any of them that you don&#8217;t use.  Say we don&#8217;t want to handle the <em>Priority Mail Large Flat Rate Board Game Box</em>.  Just delete this block from the snippet above and that box will be removed from the set of available boxes.  </p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
		'i11a' =&gt; array(
			'id'       =&gt; '11',
			'name'     =&gt; 'Priority Mail Large Flat Rate Board Game Box',
			'length'   =&gt; '23.69',
			'width'    =&gt; '11.75',
			'height'   =&gt; '3',
			'weight'   =&gt; '70',
			'box_type' =&gt; 'priority',
		),
</pre></div>


<p>You can leave only one or two boxes if you want or just remove a few.  It&#8217;s totally up to you.  Feel free to post any questions in the comments.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://justabill.blog/how-to-disable-specific-flat-rate-boxes-in-the-woocommerce-usps-shipping-method/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">26229</post-id>	</item>
		<item>
		<title>Redirect Add to Cart Only on Single Product Pages</title>
		<link>https://justabill.blog/redirect-add-to-cart-only-on-single-product-pages/</link>
					<comments>https://justabill.blog/redirect-add-to-cart-only-on-single-product-pages/#respond</comments>
		
		<dc:creator><![CDATA[Bill Robbins]]></dc:creator>
		<pubDate>Thu, 29 Apr 2021 20:57:49 +0000</pubDate>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[WooCommerce]]></category>
		<guid isPermaLink="false">https://justabill.blog/?p=25254</guid>

					<description><![CDATA[I recently had a customer in chat who had an interesting request. They wanted the &#8220;add-to-cart&#8221; buttons on single product &#8230; <a href="https://justabill.blog/redirect-add-to-cart-only-on-single-product-pages/" class="read-more">Continue Reading <span class="screen-reader-text">Redirect Add to Cart Only on Single Product Pages</span></a>]]></description>
										<content:encoded><![CDATA[
<p>I recently had a customer in chat who had an interesting request.  They wanted the &#8220;add-to-cart&#8221; buttons on single product pages to redirect the user to the cart.  They wanted the other &#8220;add-to-cart&#8221; buttons to leave the user on the current page.</p>



<p>It turns out we can do this with a simple filter.  Add this to the theme&#8217;s functions.php file or use the <a href="https://wordpress.org/plugins/code-snippets/">Code Snippets</a> plugin.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
function ijab_redirect_single_add_to_cart() {
	return '/cart/';
}
add_filter( 'woocommerce_add_to_cart_form_action', 'ijab_redirect_single_add_to_cart' );
</pre></div>


<p>That should redirect simple and variable products to the cart when added from the single product page but leave product archives alone.  I&#8217;m just posting it in case it helps someone out.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://justabill.blog/redirect-add-to-cart-only-on-single-product-pages/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">25254</post-id>	</item>
		<item>
		<title>How to Show 6 Random Products Out of the 20 Most Recent</title>
		<link>https://justabill.blog/how-to-show-6-random-products-out-of-the-20-most-recent/</link>
					<comments>https://justabill.blog/how-to-show-6-random-products-out-of-the-20-most-recent/#respond</comments>
		
		<dc:creator><![CDATA[Bill Robbins]]></dc:creator>
		<pubDate>Thu, 08 Apr 2021 23:10:39 +0000</pubDate>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[WooCommerce]]></category>
		<guid isPermaLink="false">https://justabill.blog/?p=25173</guid>

					<description><![CDATA[Recently, a customer had an unusual request. They wanted to show six random products. That&#8217;s not hard at all, but &#8230; <a href="https://justabill.blog/how-to-show-6-random-products-out-of-the-20-most-recent/" class="read-more">Continue Reading <span class="screen-reader-text">How to Show 6 Random Products Out of the 20 Most Recent</span></a>]]></description>
										<content:encoded><![CDATA[
<p>Recently, a customer had an unusual request.  They wanted to show six random products.  That&#8217;s not hard at all, but they wanted these six to come from the 20 most recently published.  That&#8217;s a bit trickier.  The built-in <code>[product]</code> shortcode in WooCommerce can show 6 random products, but it can&#8217;t set set the overall pool of products to be the 20 most recent. </p>



<p>Since we don&#8217;t have an off-the-shelf shortcode for this, we&#8217;ll need to cook one up.  To start out, let&#8217;s grab the sample product loop from the <a href="https://docs.woocommerce.com/document/sample-products-loop/">WooCommerce documentation</a>.  </p>



<figure class="wp-block-embed is-type-rich is-provider-embed-handler wp-block-embed-embed-handler"><div class="wp-block-embed__wrapper">
<style>.gist table { margin-bottom: 0; }</style><div style="tab-size: 8" id="gist88078047" class="gist">
    <div class="gist-file" translate="no">
      <div class="gist-data">
        <div class="js-gist-file-update-container js-task-list-container file-box">
  <div id="file-wc-sample-products-loop-php" class="file my-2">
    
  <div itemprop="text" class="Box-body p-0 blob-wrapper data type-php  ">

      
<table class="highlight tab-size js-file-line-container" data-tab-size="8" data-paste-markdown-skip>
      <tr>
        <td id="file-wc-sample-products-loop-php-L1" class="blob-num js-line-number" data-line-number="1"></td>
        <td id="file-wc-sample-products-loop-php-LC1" class="blob-code blob-code-inner js-file-line"><span class=pl-kos>&lt;</span><span class=pl-ent>ul</span> <span class=pl-c1>class</span>=&quot;<span class=pl-s>products</span>&quot;<span class=pl-kos>&gt;</span></td>
      </tr>
      <tr>
        <td id="file-wc-sample-products-loop-php-L2" class="blob-num js-line-number" data-line-number="2"></td>
        <td id="file-wc-sample-products-loop-php-LC2" class="blob-code blob-code-inner js-file-line">	<span class=pl-ent>&lt;?php</span></td>
      </tr>
      <tr>
        <td id="file-wc-sample-products-loop-php-L3" class="blob-num js-line-number" data-line-number="3"></td>
        <td id="file-wc-sample-products-loop-php-LC3" class="blob-code blob-code-inner js-file-line">		<span class=pl-s1><span class=pl-c1>$</span>args</span> = <span class=pl-en>array</span>(</td>
      </tr>
      <tr>
        <td id="file-wc-sample-products-loop-php-L4" class="blob-num js-line-number" data-line-number="4"></td>
        <td id="file-wc-sample-products-loop-php-LC4" class="blob-code blob-code-inner js-file-line">			<span class=pl-s>&#39;post_type&#39;</span> =&gt; <span class=pl-s>&#39;product&#39;</span>,</td>
      </tr>
      <tr>
        <td id="file-wc-sample-products-loop-php-L5" class="blob-num js-line-number" data-line-number="5"></td>
        <td id="file-wc-sample-products-loop-php-LC5" class="blob-code blob-code-inner js-file-line">			<span class=pl-s>&#39;posts_per_page&#39;</span> =&gt; <span class=pl-c1>12</span></td>
      </tr>
      <tr>
        <td id="file-wc-sample-products-loop-php-L6" class="blob-num js-line-number" data-line-number="6"></td>
        <td id="file-wc-sample-products-loop-php-LC6" class="blob-code blob-code-inner js-file-line">			);</td>
      </tr>
      <tr>
        <td id="file-wc-sample-products-loop-php-L7" class="blob-num js-line-number" data-line-number="7"></td>
        <td id="file-wc-sample-products-loop-php-LC7" class="blob-code blob-code-inner js-file-line">		<span class=pl-s1><span class=pl-c1>$</span>loop</span> = <span class=pl-k>new</span> <span class=pl-v>WP_Query</span>( <span class=pl-s1><span class=pl-c1>$</span>args</span> );</td>
      </tr>
      <tr>
        <td id="file-wc-sample-products-loop-php-L8" class="blob-num js-line-number" data-line-number="8"></td>
        <td id="file-wc-sample-products-loop-php-LC8" class="blob-code blob-code-inner js-file-line">		<span class=pl-k>if</span> ( <span class=pl-s1><span class=pl-c1>$</span>loop</span>-&gt;<span class=pl-en>have_posts</span>() ) {</td>
      </tr>
      <tr>
        <td id="file-wc-sample-products-loop-php-L9" class="blob-num js-line-number" data-line-number="9"></td>
        <td id="file-wc-sample-products-loop-php-LC9" class="blob-code blob-code-inner js-file-line">			<span class=pl-k>while</span> ( <span class=pl-s1><span class=pl-c1>$</span>loop</span>-&gt;<span class=pl-en>have_posts</span>() ) : <span class=pl-s1><span class=pl-c1>$</span>loop</span>-&gt;<span class=pl-en>the_post</span>();</td>
      </tr>
      <tr>
        <td id="file-wc-sample-products-loop-php-L10" class="blob-num js-line-number" data-line-number="10"></td>
        <td id="file-wc-sample-products-loop-php-LC10" class="blob-code blob-code-inner js-file-line">				<span class=pl-en>wc_get_template_part</span>( <span class=pl-s>&#39;content&#39;</span>, <span class=pl-s>&#39;product&#39;</span> );</td>
      </tr>
      <tr>
        <td id="file-wc-sample-products-loop-php-L11" class="blob-num js-line-number" data-line-number="11"></td>
        <td id="file-wc-sample-products-loop-php-LC11" class="blob-code blob-code-inner js-file-line">			<span class=pl-k>endwhile</span>;</td>
      </tr>
      <tr>
        <td id="file-wc-sample-products-loop-php-L12" class="blob-num js-line-number" data-line-number="12"></td>
        <td id="file-wc-sample-products-loop-php-LC12" class="blob-code blob-code-inner js-file-line">		} <span class=pl-k>else</span> {</td>
      </tr>
      <tr>
        <td id="file-wc-sample-products-loop-php-L13" class="blob-num js-line-number" data-line-number="13"></td>
        <td id="file-wc-sample-products-loop-php-LC13" class="blob-code blob-code-inner js-file-line">			<span class=pl-k>echo</span> <span class=pl-en>__</span>( <span class=pl-s>&#39;No products found&#39;</span> );</td>
      </tr>
      <tr>
        <td id="file-wc-sample-products-loop-php-L14" class="blob-num js-line-number" data-line-number="14"></td>
        <td id="file-wc-sample-products-loop-php-LC14" class="blob-code blob-code-inner js-file-line">		}</td>
      </tr>
      <tr>
        <td id="file-wc-sample-products-loop-php-L15" class="blob-num js-line-number" data-line-number="15"></td>
        <td id="file-wc-sample-products-loop-php-LC15" class="blob-code blob-code-inner js-file-line">		<span class=pl-en>wp_reset_postdata</span>();</td>
      </tr>
      <tr>
        <td id="file-wc-sample-products-loop-php-L16" class="blob-num js-line-number" data-line-number="16"></td>
        <td id="file-wc-sample-products-loop-php-LC16" class="blob-code blob-code-inner js-file-line">	<span class=pl-ent>?&gt;</span></td>
      </tr>
      <tr>
        <td id="file-wc-sample-products-loop-php-L17" class="blob-num js-line-number" data-line-number="17"></td>
        <td id="file-wc-sample-products-loop-php-LC17" class="blob-code blob-code-inner js-file-line"><span class=pl-kos>&lt;/</span><span class=pl-ent>ul</span><span class=pl-kos>&gt;</span><span class=pl-c>&lt;!&#8211;/.products&#8211;&gt;</span></td>
      </tr>
</table>


  </div>

  </div>
</div>

      </div>
      <div class="gist-meta">
        <a href="https://gist.github.com/woogists/c2c3de3e01db4102fd5fabcd4f394055/raw/1bc00f614b11520fb4554714ea6075a8b612d74a/wc-sample-products-loop.php" style="float:right">view raw</a>
        <a href="https://gist.github.com/woogists/c2c3de3e01db4102fd5fabcd4f394055#file-wc-sample-products-loop-php">wc-sample-products-loop.php</a>
        hosted with &#10084; by <a href="https://github.com">GitHub</a>
      </div>
    </div>
</div>

</div></figure>



<p>That will return a list of the 12 most recent products.  By default wp_query returns objects in descending order so the latest items will be first.  First we need to make a few changes to the arguments.  We need a pool of twenty products, so we&#8217;ll change that.  I&#8217;m also adding in the date as the orderby parameter so that&#8217;ll be clear in case we ever have to come back and edit this code.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
	$args = array(
		'post_type'			=&gt; 'product',
		'posts_per_page'	=&gt; 20,
		'orderby'			=&gt; 'date',
		'order'				=&gt; 'DESC',
		'no_found_rows'		=&gt; true,
	);
</pre></div>


<p>The kicker here is we only want to show six of these twenty products.  We can add a couple of variables here to handle that.  We&#8217;ll have one for the count and another one for the maximum number of products.  We&#8217;ll increment the <code>$counter</code> variable at the end of each loop so that it&#8217;ll keep track of where we are in the list.  From there, we can add them to the while loop so it only runs six times.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
	$counter = 1;
	$max = 6;
	...
	while ( ($loop-&gt;have_posts()) &amp;&amp; ($counter &lt;= $max) ) : $loop-&gt;the_post();
	...
		$counter++;
	endwhile;
</pre></div>


<p>The next part is getting the six products to be random ones from our pool of twenty.  We can use PHP&#8217;s built-in <code>shuffle</code> function to reorder the posts.  We don&#8217;t apply it to <code>$loop</code> directly since it has more data than just the product content.  We need to add it to the <code>posts</code> array that&#8217;s nested inside this multidimensional array.  That&#8217;ll look like this:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
	$loop = new WP_Query( $args );
	shuffle($loop-&gt;posts);
</pre></div>


<p>We can wrap this up in a function and add it to a shortcode.  Then all we&#8217;ll need to do is insert <code>[randomproducts]</code> into the content of a page/post and we&#8217;ll have a list of six random products out of our most recent twenty.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
function ijab_random_products() {
	?&gt;

&lt;ul class=&quot;products columns-3&quot;&gt;
	&lt;?php
	$args = array(
		'post_type'			=&gt; 'product',
		'posts_per_page'	=&gt; 20,
		'orderby'			=&gt; 'date',
		'order'				=&gt; 'DESC',
		'no_found_rows'		=&gt; true,
	);
	$counter = 1;
	$max = 6;
	$loop = new WP_Query( $args );
	shuffle($loop-&gt;posts);
	if ( $loop-&gt;have_posts() ) {
		while ( ($loop-&gt;have_posts()) &amp;&amp; ($counter &lt;= $max) ) : $loop-&gt;the_post();
			wc_get_template_part( 'content', 'product' );
			$counter++;
		endwhile;
	} else {
		echo __( 'No products found' );
	}
	wp_reset_postdata();
	?&gt;
&lt;/ul&gt;

	&lt;?php
}
add_shortcode( 'randomproducts', 'ijab_random_products' );
</pre></div>


<p>That&#8217;ll display the products in two rows of three columns.  You can change the <code>columns-3</code> in the UL element in that snippet to a different number to adjust the columns.  Have fun!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://justabill.blog/how-to-show-6-random-products-out-of-the-20-most-recent/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">25173</post-id>	</item>
		<item>
		<title>Remove &#8220;Product&#8221; from WooCommerce Attribute Breadcrumbs</title>
		<link>https://justabill.blog/remove-product-from-woocommerce-attribute-breadcrumbs/</link>
					<comments>https://justabill.blog/remove-product-from-woocommerce-attribute-breadcrumbs/#comments</comments>
		
		<dc:creator><![CDATA[Bill Robbins]]></dc:creator>
		<pubDate>Mon, 22 Mar 2021 13:30:00 +0000</pubDate>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[WooCommerce]]></category>
		<guid isPermaLink="false">https://justabill.blog/?p=25052</guid>

					<description><![CDATA[Have you ever noticed how the breadcrumbs look when viewing an attribute term archive in WooCommerce? It&#8217;ll be something like &#8230; <a href="https://justabill.blog/remove-product-from-woocommerce-attribute-breadcrumbs/" class="read-more">Continue Reading <span class="screen-reader-text">Remove &#8220;Product&#8221; from WooCommerce Attribute Breadcrumbs</span></a>]]></description>
										<content:encoded><![CDATA[
<p>Have you ever noticed how the breadcrumbs look when viewing an attribute term archive in WooCommerce?  It&#8217;ll be something like this: </p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1020" height="465" src="https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/breadcrumbs.png?resize=1020%2C465&#038;ssl=1" alt="" class="wp-image-25061" srcset="https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/breadcrumbs.png?resize=1024%2C467&amp;ssl=1 1024w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/breadcrumbs.png?resize=300%2C137&amp;ssl=1 300w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/breadcrumbs.png?resize=768%2C351&amp;ssl=1 768w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/breadcrumbs.png?resize=600%2C274&amp;ssl=1 600w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/breadcrumbs.png?resize=1200%2C548&amp;ssl=1 1200w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/breadcrumbs.png?w=1262&amp;ssl=1 1262w" sizes="(max-width: 1020px) 100vw, 1020px" data-recalc-dims="1" /></figure>



<p>The tricky part comes in when we try to find the source of &#8220;Product&#8221; right before color.  If I look at the attributes in my dashboard, it only shows color.  &#8220;Product&#8221; is not part of the title.  So where is this coming from?</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1020" height="205" src="https://i2.wp.com/justabill.blog/wp-content/uploads/2021/03/attributes.png?resize=1020%2C205&#038;ssl=1" alt="" class="wp-image-25062" srcset="https://i2.wp.com/justabill.blog/wp-content/uploads/2021/03/attributes.png?resize=1024%2C206&amp;ssl=1 1024w, https://i2.wp.com/justabill.blog/wp-content/uploads/2021/03/attributes.png?resize=300%2C60&amp;ssl=1 300w, https://i2.wp.com/justabill.blog/wp-content/uploads/2021/03/attributes.png?resize=768%2C155&amp;ssl=1 768w, https://i2.wp.com/justabill.blog/wp-content/uploads/2021/03/attributes.png?resize=1536%2C309&amp;ssl=1 1536w, https://i2.wp.com/justabill.blog/wp-content/uploads/2021/03/attributes.png?resize=600%2C121&amp;ssl=1 600w, https://i2.wp.com/justabill.blog/wp-content/uploads/2021/03/attributes.png?resize=1200%2C242&amp;ssl=1 1200w, https://i2.wp.com/justabill.blog/wp-content/uploads/2021/03/attributes.png?w=1896&amp;ssl=1 1896w" sizes="(max-width: 1020px) 100vw, 1020px" data-recalc-dims="1" /></figure>



<p>After digging through the code a bit, I found this function that creates the part of the breadcrumbs for taxonomies:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
protected function add_crumbs_tax() {
	$this_term = $GLOBALS&#91;'wp_query']-&gt;get_queried_object();
	$taxonomy  = get_taxonomy( $this_term-&gt;taxonomy );

	$this-&gt;add_crumb( $taxonomy-&gt;labels-&gt;name );  

	if ( 0 !== intval( $this_term-&gt;parent ) ) {
		$this-&gt;term_ancestors( $this_term-&gt;term_id, $this_term-&gt;taxonomy );
	}

	$this-&gt;add_crumb( single_term_title( '', false ), get_term_link( $this_term-&gt;term_id, $this_term-&gt;taxonomy ) );
}
</pre></div>


<p>Looking at it we don&#8217;t see &#8220;Product&#8221; in here at all, but there is a hidden reference to it.  This line points us to the taxonomy label name.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
$this-&gt;add_crumb( $taxonomy-&gt;labels-&gt;name );
</pre></div>


<p>What this tells us the &#8220;Product&#8221; is actually part of the <strong>label</strong> for this taxonomy.  Indeed if we open up <code>class-wc-post-types.php</code> we&#8217;ll see the attribute taxonomies registered.  This line defines the label for our attributes:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
/* translators: %s: attribute name */
'name' =&gt; sprintf( _x( 'Product %s', 'Product Attribute', 'woocommerce' ), $label ),
</pre></div>


<p>With this, we can change the text using a translation plugin like <a href="https://wordpress.org/plugins/loco-translate/">Loco Translate</a> or <a href="https://wordpress.org/plugins/say-what/">Say What</a>.  You&#8217;ll want to find this string:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
Product %s
</pre></div>


<p>and replace it with this:</p>



<pre class="wp-block-code"><code>%s</code></pre>



<p>Here&#8217;s what this looks like with Say What.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="798" height="794" src="https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/say-what-changes.png?resize=798%2C794&#038;ssl=1" alt="" class="wp-image-25069" srcset="https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/say-what-changes.png?w=798&amp;ssl=1 798w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/say-what-changes.png?resize=300%2C298&amp;ssl=1 300w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/say-what-changes.png?resize=150%2C150&amp;ssl=1 150w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/say-what-changes.png?resize=768%2C764&amp;ssl=1 768w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/say-what-changes.png?resize=250%2C250&amp;ssl=1 250w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/say-what-changes.png?resize=600%2C597&amp;ssl=1 600w" sizes="(max-width: 798px) 100vw, 798px" data-recalc-dims="1" /></figure>



<h2>Results</h2>



<p>Now that we have our changes in place, we can see how this works on the front end of the site.  As you can see instead of it saying &#8220;Product Color&#8221; now it simply says &#8220;Color&#8221; like we wanted.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1020" height="476" src="https://i2.wp.com/justabill.blog/wp-content/uploads/2021/03/finished.png?resize=1020%2C476&#038;ssl=1" alt="" class="wp-image-25071" srcset="https://i2.wp.com/justabill.blog/wp-content/uploads/2021/03/finished.png?resize=1024%2C478&amp;ssl=1 1024w, https://i2.wp.com/justabill.blog/wp-content/uploads/2021/03/finished.png?resize=300%2C140&amp;ssl=1 300w, https://i2.wp.com/justabill.blog/wp-content/uploads/2021/03/finished.png?resize=768%2C358&amp;ssl=1 768w, https://i2.wp.com/justabill.blog/wp-content/uploads/2021/03/finished.png?resize=600%2C280&amp;ssl=1 600w, https://i2.wp.com/justabill.blog/wp-content/uploads/2021/03/finished.png?w=1188&amp;ssl=1 1188w" sizes="(max-width: 1020px) 100vw, 1020px" data-recalc-dims="1" /></figure>



<p>That one was a bit tricky to find so I wanted to document it in case someone else is looking for this.  If you have any questions, ask away in the comments.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://justabill.blog/remove-product-from-woocommerce-attribute-breadcrumbs/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">25052</post-id>	</item>
		<item>
		<title>Autocomplete Paid Orders in WooCommerce</title>
		<link>https://justabill.blog/autocomplete-paid-orders-in-woocommerce/</link>
					<comments>https://justabill.blog/autocomplete-paid-orders-in-woocommerce/#respond</comments>
		
		<dc:creator><![CDATA[Bill Robbins]]></dc:creator>
		<pubDate>Mon, 15 Mar 2021 23:18:46 +0000</pubDate>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[WooCommerce]]></category>
		<guid isPermaLink="false">https://justabill.blog/?p=25012</guid>

					<description><![CDATA[There is a snippet you may have seen to automatically complete orders in WooCommerce. The only problem is this will &#8230; <a href="https://justabill.blog/autocomplete-paid-orders-in-woocommerce/" class="read-more">Continue Reading <span class="screen-reader-text">Autocomplete Paid Orders in WooCommerce</span></a>]]></description>
										<content:encoded><![CDATA[
<p>There is a <a href="https://docs.woocommerce.com/document/automatically-complete-orders/">snippet you may have seen to automatically complete orders</a> in WooCommerce.  The only problem is this will only autocomplete orders when the customer visits the thank you page.  For situations where the user skips the thank you page or the order is automated, this won&#8217;t help us.  What we need is to take this snippet and use a different hook.  </p>



<p>WooCommerce has just what we need in the <code>woocommerce_payment_complete</code> hook.  This is triggered once the order has been paid for.  When we add this to the snippet, this is what we end up with.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
add_action( 'woocommerce_payment_complete', 'ijab_autocomplete_paid_orders' );
function ijab_autocomplete_paid_orders( $order_id ) { 
    if ( ! $order_id ) {
        return;
    }

    $order = wc_get_order( $order_id );
    $order-&gt;update_status( 'completed' );
}
</pre></div>


<p>Now this snippet will autocomplete orders even if the thank you page isn&#8217;t triggered like with subscription renewals.  </p>
]]></content:encoded>
					
					<wfw:commentRss>https://justabill.blog/autocomplete-paid-orders-in-woocommerce/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">25012</post-id>	</item>
		<item>
		<title>Limit WooCommerce Order Search to Order Numbers Only</title>
		<link>https://justabill.blog/limit-woocommerce-order-search-to-order-numbers-only/</link>
					<comments>https://justabill.blog/limit-woocommerce-order-search-to-order-numbers-only/#respond</comments>
		
		<dc:creator><![CDATA[Bill Robbins]]></dc:creator>
		<pubDate>Mon, 01 Mar 2021 16:08:47 +0000</pubDate>
				<category><![CDATA[WooCommerce]]></category>
		<guid isPermaLink="false">https://justabill.blog/?p=24882</guid>

					<description><![CDATA[WooCommerce has a helpful search mechanism that you can use to locate orders in the admin. It can find orders &#8230; <a href="https://justabill.blog/limit-woocommerce-order-search-to-order-numbers-only/" class="read-more">Continue Reading <span class="screen-reader-text">Limit WooCommerce Order Search to Order Numbers Only</span></a>]]></description>
										<content:encoded><![CDATA[
<p>WooCommerce has a helpful search mechanism that you can use to locate orders in the admin.  It can find orders by the user&#8217;s name, address, email, or order number.  We can find this in <code>woocommerce/includes/data-stores/class-wc-order-data-store-cpt.php</code> starting on <a href="https://github.com/woocommerce/woocommerce/blob/23710744c01ded649d6a94a4eaea8745e543159f/includes/data-stores/class-wc-order-data-store-cpt.php#L521">line 521</a>.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
$search_fields = array_map(
	'wc_clean',
	apply_filters(
		'woocommerce_shop_order_search_fields',
		array(
			'_billing_address_index',
			'_shipping_address_index',
			'_billing_last_name',
			'_billing_email',
		)
	)
);
$order_ids     = array();
</pre></div>


<p>What this means is WooCommerce will search though all of this extra information to find an order.  While that can be helpful, it may take a long time if the site has an <em>extremely</em> large number of orders.</p>



<p>Notice that in the filters, the order number search isn&#8217;t mentioned.  What we can do is create a function that removes these search options so that only order numbers are searched.  Here&#8217;s a snippet that can do that for you.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
add_filter( 'woocommerce_shop_order_search_fields', '__return_false' );
</pre></div>


<p>Now when I search in the order admin, I can still search for orders by order number, but with the other criteria removed, searching is much faster.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" width="1020" height="296" src="https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/by-order-number.png?resize=1020%2C296&#038;ssl=1" alt="" class="wp-image-24887" srcset="https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/by-order-number.png?resize=1024%2C297&amp;ssl=1 1024w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/by-order-number.png?resize=300%2C87&amp;ssl=1 300w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/by-order-number.png?resize=768%2C223&amp;ssl=1 768w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/by-order-number.png?resize=1536%2C445&amp;ssl=1 1536w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/by-order-number.png?resize=2048%2C594&amp;ssl=1 2048w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/by-order-number.png?resize=600%2C174&amp;ssl=1 600w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/by-order-number.png?resize=1200%2C348&amp;ssl=1 1200w" sizes="(max-width: 1020px) 100vw, 1020px" data-recalc-dims="1" /><figcaption>Search by order number</figcaption></figure></div>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" width="1020" height="241" src="https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/no-orders.png?resize=1020%2C241&#038;ssl=1" alt="" class="wp-image-24888" srcset="https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/no-orders.png?resize=1024%2C242&amp;ssl=1 1024w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/no-orders.png?resize=300%2C71&amp;ssl=1 300w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/no-orders.png?resize=768%2C182&amp;ssl=1 768w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/no-orders.png?resize=1536%2C364&amp;ssl=1 1536w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/no-orders.png?resize=2048%2C485&amp;ssl=1 2048w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/no-orders.png?resize=600%2C142&amp;ssl=1 600w, https://i1.wp.com/justabill.blog/wp-content/uploads/2021/03/no-orders.png?resize=1200%2C284&amp;ssl=1 1200w" sizes="(max-width: 1020px) 100vw, 1020px" data-recalc-dims="1" /><figcaption>Search by last name</figcaption></figure></div>



<p>Here&#8217;s what a typical search by last name looks like:</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" width="1020" height="420" src="https://i0.wp.com/justabill.blog/wp-content/uploads/2021/03/typical-last-name-search.png?resize=1020%2C420&#038;ssl=1" alt="" class="wp-image-24890" srcset="https://i0.wp.com/justabill.blog/wp-content/uploads/2021/03/typical-last-name-search.png?resize=1024%2C422&amp;ssl=1 1024w, https://i0.wp.com/justabill.blog/wp-content/uploads/2021/03/typical-last-name-search.png?resize=300%2C124&amp;ssl=1 300w, https://i0.wp.com/justabill.blog/wp-content/uploads/2021/03/typical-last-name-search.png?resize=768%2C317&amp;ssl=1 768w, https://i0.wp.com/justabill.blog/wp-content/uploads/2021/03/typical-last-name-search.png?resize=1536%2C633&amp;ssl=1 1536w, https://i0.wp.com/justabill.blog/wp-content/uploads/2021/03/typical-last-name-search.png?resize=2048%2C845&amp;ssl=1 2048w, https://i0.wp.com/justabill.blog/wp-content/uploads/2021/03/typical-last-name-search.png?resize=600%2C247&amp;ssl=1 600w, https://i0.wp.com/justabill.blog/wp-content/uploads/2021/03/typical-last-name-search.png?resize=1200%2C495&amp;ssl=1 1200w" sizes="(max-width: 1020px) 100vw, 1020px" data-recalc-dims="1" /><figcaption>Normal search by last name</figcaption></figure></div>



<p>We can also <strong>add</strong> additional search criteria with this filter.  Say we wanted to be able to search by the order total.  To do that we need to add <code>_order_total</code> to the filter.  Here&#8217;s one way to do that.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
function ijab_woo_extra_order_meta_search($args) {
    
	$args&#91;] = '_order_total';
	
	return $args;
}
add_filter( 'woocommerce_shop_order_search_fields', 'ijab_woo_extra_order_meta_search' );
</pre></div>


<p>With that you can search by the order total amount and have it show matching orders.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1020" height="262" src="https://i2.wp.com/justabill.blog/wp-content/uploads/2021/03/order-total.png?resize=1020%2C262&#038;ssl=1" alt="" class="wp-image-24894" srcset="https://i2.wp.com/justabill.blog/wp-content/uploads/2021/03/order-total.png?resize=1024%2C263&amp;ssl=1 1024w, https://i2.wp.com/justabill.blog/wp-content/uploads/2021/03/order-total.png?resize=300%2C77&amp;ssl=1 300w, https://i2.wp.com/justabill.blog/wp-content/uploads/2021/03/order-total.png?resize=768%2C197&amp;ssl=1 768w, https://i2.wp.com/justabill.blog/wp-content/uploads/2021/03/order-total.png?resize=1536%2C394&amp;ssl=1 1536w, https://i2.wp.com/justabill.blog/wp-content/uploads/2021/03/order-total.png?resize=2048%2C525&amp;ssl=1 2048w, https://i2.wp.com/justabill.blog/wp-content/uploads/2021/03/order-total.png?resize=600%2C154&amp;ssl=1 600w, https://i2.wp.com/justabill.blog/wp-content/uploads/2021/03/order-total.png?resize=1200%2C308&amp;ssl=1 1200w" sizes="(max-width: 1020px) 100vw, 1020px" data-recalc-dims="1" /></figure>



<p>So now you know how to modify the built-in order search for WooCommerce.  If you have any other creative uses for this or questions, let me know in the comments.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://justabill.blog/limit-woocommerce-order-search-to-order-numbers-only/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">24882</post-id>	</item>
		<item>
		<title>Style File Upload Button with Product Add-Ons</title>
		<link>https://justabill.blog/style-file-upload-button-with-product-add-ons/</link>
					<comments>https://justabill.blog/style-file-upload-button-with-product-add-ons/#respond</comments>
		
		<dc:creator><![CDATA[Bill Robbins]]></dc:creator>
		<pubDate>Fri, 08 Jan 2021 14:30:16 +0000</pubDate>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[WooCommerce]]></category>
		<guid isPermaLink="false">https://justabill.blog/?p=24631</guid>

					<description><![CDATA[The Product Add-ons extension for WooCommerce is a simple to use plugin that lets you add extra option fields to &#8230; <a href="https://justabill.blog/style-file-upload-button-with-product-add-ons/" class="read-more">Continue Reading <span class="screen-reader-text">Style File Upload Button with Product Add-Ons</span></a>]]></description>
										<content:encoded><![CDATA[
<p>The Product Add-ons extension for WooCommerce is a simple to use plugin that lets you add extra option fields to your products.  The file upload field makes it possible for customers to send a file like a logo that you can use when customizing their order.  </p>



<p>The only downside is the default appearance of the file type input is its styling.  It often doesn&#8217;t really match the rest of the site.  Here&#8217;s an example of what it looks like by default.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1020" height="638" src="https://i2.wp.com/justabill.blog/wp-content/uploads/2021/01/standard.png?resize=1020%2C638&#038;ssl=1" alt="" class="wp-image-24636" srcset="https://i2.wp.com/justabill.blog/wp-content/uploads/2021/01/standard.png?resize=1024%2C640&amp;ssl=1 1024w, https://i2.wp.com/justabill.blog/wp-content/uploads/2021/01/standard.png?resize=300%2C188&amp;ssl=1 300w, https://i2.wp.com/justabill.blog/wp-content/uploads/2021/01/standard.png?resize=768%2C480&amp;ssl=1 768w, https://i2.wp.com/justabill.blog/wp-content/uploads/2021/01/standard.png?resize=1536%2C960&amp;ssl=1 1536w, https://i2.wp.com/justabill.blog/wp-content/uploads/2021/01/standard.png?resize=2048%2C1280&amp;ssl=1 2048w, https://i2.wp.com/justabill.blog/wp-content/uploads/2021/01/standard.png?resize=600%2C375&amp;ssl=1 600w, https://i2.wp.com/justabill.blog/wp-content/uploads/2021/01/standard.png?resize=1200%2C750&amp;ssl=1 1200w" sizes="(max-width: 1020px) 100vw, 1020px" data-recalc-dims="1" /><figcaption>Default look</figcaption></figure>



<p>What makes this tricky to work with is how the &#8220;Choose File&#8221; button is set up in the HTML.  Often we can pick out a specific element in the HTML and then target it with CSS.  In this case, the input covers that entire section so our normal bag of tricks probably won&#8217;t work the way we envision.</p>



<p>The alternative is to actually hide the button and use a &#8220;pseudo element&#8221; in the CSS to create a new one.  Here&#8217;s a snippet you can use to do this.</p>



<pre class="wp-block-code"><code>.wc-pao-addon-file-upload::-webkit-file-upload-button {
  visibility: hidden;
  width: 0;
}

.wc-pao-addon-file-upload::before {
  content: 'Select files';
  display: inline-block;
  border: none;
  padding: 5px 8px;
  outline: none;
  white-space: nowrap;
  -webkit-user-select: none;
  cursor: pointer;
  color: #fff;
  background-color: #1392eb;
}

.wc-pao-addon-file-upload:hover::before {
  background-color: #000;
}
</code></pre>



<p>The top style hides the original button and makes it so it doesn&#8217;t take up any horizontal space.  That way we don&#8217;t end up smushing the &#8220;No file chosen&#8221; text.  </p>



<p>The second style sets what our button looks like.  For best results, you&#8217;ll want to adjust these to match the buttons on your site in terms of color and size.  The last style sets the hover color of the button.</p>



<p>Once this has been added to the site, we&#8217;ll end up with something that looks like this.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1020" height="657" src="https://i0.wp.com/justabill.blog/wp-content/uploads/2021/01/new-button.png?resize=1020%2C657&#038;ssl=1" alt="" class="wp-image-24640" srcset="https://i0.wp.com/justabill.blog/wp-content/uploads/2021/01/new-button.png?resize=1024%2C660&amp;ssl=1 1024w, https://i0.wp.com/justabill.blog/wp-content/uploads/2021/01/new-button.png?resize=300%2C193&amp;ssl=1 300w, https://i0.wp.com/justabill.blog/wp-content/uploads/2021/01/new-button.png?resize=768%2C495&amp;ssl=1 768w, https://i0.wp.com/justabill.blog/wp-content/uploads/2021/01/new-button.png?resize=1536%2C989&amp;ssl=1 1536w, https://i0.wp.com/justabill.blog/wp-content/uploads/2021/01/new-button.png?resize=2048%2C1319&amp;ssl=1 2048w, https://i0.wp.com/justabill.blog/wp-content/uploads/2021/01/new-button.png?resize=600%2C386&amp;ssl=1 600w, https://i0.wp.com/justabill.blog/wp-content/uploads/2021/01/new-button.png?resize=1200%2C773&amp;ssl=1 1200w" sizes="(max-width: 1020px) 100vw, 1020px" data-recalc-dims="1" /><figcaption>Custom button</figcaption></figure>



<p>It&#8217;s not a radical departure, but it can make the file upload feel like it&#8217;s better integrated into the site.  </p>
]]></content:encoded>
					
					<wfw:commentRss>https://justabill.blog/style-file-upload-button-with-product-add-ons/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">24631</post-id>	</item>
		<item>
		<title>Hide WooCommerce Checkout Button Until Terms and Conditions Accepted</title>
		<link>https://justabill.blog/hide-woocommerce-checkout-button-until-terms-and-conditions-accepted/</link>
					<comments>https://justabill.blog/hide-woocommerce-checkout-button-until-terms-and-conditions-accepted/#respond</comments>
		
		<dc:creator><![CDATA[Bill Robbins]]></dc:creator>
		<pubDate>Tue, 29 Dec 2020 13:30:00 +0000</pubDate>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[WooCommerce]]></category>
		<guid isPermaLink="false">https://justabill.blog/?p=14565</guid>

					<description><![CDATA[Often times stores need to require terms and conditions to be accepted for anyone placing an order. WooCommerce can do &#8230; <a href="https://justabill.blog/hide-woocommerce-checkout-button-until-terms-and-conditions-accepted/" class="read-more">Continue Reading <span class="screen-reader-text">Hide WooCommerce Checkout Button Until Terms and Conditions Accepted</span></a>]]></description>
										<content:encoded><![CDATA[
<p>Often times stores need to require terms and conditions to be accepted for anyone placing an order.  WooCommerce can do this out of the box, but the checkout button will still be present.  You can hide it until the &#8220;terms and conditions&#8221; have been accepted with a bit of JavaScript though.  </p>



<p>Add this snippet to your theme&#8217;s functions.php file or via the Code Snippets plugin.</p>



<pre class="wp-block-code"><code>add_action( 'wp_footer', function () { ?>

&lt;script>
jQuery(document).ready(function(){
	function showCheckout() {
		jQuery('#place_order').hide();
		jQuery('#terms').change(function(){
			if(this.checked)
				jQuery('#place_order').fadeIn('slow');
			else
				jQuery('#place_order').fadeOut('slow');
		});
	}
	setTimeout(showCheckout, 500)
});
&lt;/script>
&lt;?php } );</code></pre>



<p>This will hide the payment button once the page has finished loading.  Then the user will have to check the box to accept terms and conditions to have the button appear again.  </p>
]]></content:encoded>
					
					<wfw:commentRss>https://justabill.blog/hide-woocommerce-checkout-button-until-terms-and-conditions-accepted/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">14565</post-id>	</item>
		<item>
		<title>Move Element from One Location to Another with JavaScript</title>
		<link>https://justabill.blog/move-element-from-one-location-to-another-with-javascript/</link>
					<comments>https://justabill.blog/move-element-from-one-location-to-another-with-javascript/#respond</comments>
		
		<dc:creator><![CDATA[Bill Robbins]]></dc:creator>
		<pubDate>Fri, 14 Aug 2020 15:07:00 +0000</pubDate>
				<category><![CDATA[Tips]]></category>
		<guid isPermaLink="false">https://justabill.blog/?p=960</guid>

					<description><![CDATA[Often times we can move elements around on a page with CSS, but sometimes that&#8217;s just not a good solution &#8230; <a href="https://justabill.blog/move-element-from-one-location-to-another-with-javascript/" class="read-more">Continue Reading <span class="screen-reader-text">Move Element from One Location to Another with JavaScript</span></a>]]></description>
										<content:encoded><![CDATA[
<p>Often times we can move elements around on a page with CSS, but sometimes that&#8217;s just not a good solution when elements need to taken across an entire screen.  </p>



<p>Here&#8217;s an example so you can see what I mean.  A user wants to move the Amazon Pay section from down at the bottom of the checkout page to the top.  </p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1094" height="934" src="https://i1.wp.com/justabill.blog/wp-content/uploads/2020/02/relocated-Amazon-Pay.png?fit=1020%2C871&amp;ssl=1" alt="" class="wp-image-962" srcset="https://i1.wp.com/justabill.blog/wp-content/uploads/2020/02/relocated-Amazon-Pay.png?w=1094&amp;ssl=1 1094w, https://i1.wp.com/justabill.blog/wp-content/uploads/2020/02/relocated-Amazon-Pay.png?resize=300%2C256&amp;ssl=1 300w, https://i1.wp.com/justabill.blog/wp-content/uploads/2020/02/relocated-Amazon-Pay.png?resize=1024%2C874&amp;ssl=1 1024w, https://i1.wp.com/justabill.blog/wp-content/uploads/2020/02/relocated-Amazon-Pay.png?resize=768%2C656&amp;ssl=1 768w, https://i1.wp.com/justabill.blog/wp-content/uploads/2020/02/relocated-Amazon-Pay.png?resize=600%2C512&amp;ssl=1 600w" sizes="(max-width: 1020px) 100vw, 1020px" /></figure>



<p>Using CSS positioning we could do that, but it would be tricky to have it look right across screen sizes.  </p>



<p>Fortunately, we can use JavaScript to make the move for us.  Since WordPress comes bundled with jQuery we&#8217;ll use this library&#8217;s built-in functions to handle it.   </p>



<p>What you need to do is find out the class or ID of the item that you want to move and then the class/ID of an element right after where you want it to go.  In our example, the Amazon Pay has a class <code>wc-amazon-payments-advanced-info</code> we can use to grab it.  Now to move it to the top of the page, we can use these classes <code>form-row</code> and <code>place-order</code>.</p>



<p>jQuery comes with a function called <code>prependTo</code> which takes the specified element and adds it right before whatever other element you specify.  Using it and our classes, we can write one quick line of JavaScript to move this.</p>



<pre class="wp-block-code"><code>jQuery(".wc-amazon-payments-advanced-info").prependTo(".form-row.place-order");</code></pre>



<p>When I apply that to the page, the Amazon Pay button is moved from the area where the other payment methods are to the very top of the checkout form.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1302" height="646" src="https://i2.wp.com/justabill.blog/wp-content/uploads/2020/02/Original-Amazon-Location.png?fit=1020%2C506&amp;ssl=1" alt="" class="wp-image-963" srcset="https://i2.wp.com/justabill.blog/wp-content/uploads/2020/02/Original-Amazon-Location.png?w=1302&amp;ssl=1 1302w, https://i2.wp.com/justabill.blog/wp-content/uploads/2020/02/Original-Amazon-Location.png?resize=300%2C149&amp;ssl=1 300w, https://i2.wp.com/justabill.blog/wp-content/uploads/2020/02/Original-Amazon-Location.png?resize=1024%2C508&amp;ssl=1 1024w, https://i2.wp.com/justabill.blog/wp-content/uploads/2020/02/Original-Amazon-Location.png?resize=768%2C381&amp;ssl=1 768w, https://i2.wp.com/justabill.blog/wp-content/uploads/2020/02/Original-Amazon-Location.png?resize=600%2C298&amp;ssl=1 600w, https://i2.wp.com/justabill.blog/wp-content/uploads/2020/02/Original-Amazon-Location.png?resize=1200%2C595&amp;ssl=1 1200w" sizes="(max-width: 1020px) 100vw, 1020px" /></figure>



<p>Also, as far as the browser is concerned, the element is really in that position.  So the other items on the page will react as if it&#8217;s always been there.  </p>



<p>It&#8217;s a simple solution that you can use when CSS positioning just isn&#8217;t enough.  Even if someone has JavaScript disabled, the worst that will happen is the element won&#8217;t be moved.  </p>



<p>So now you have a new way to rearrange elements on a page.  Enjoy!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://justabill.blog/move-element-from-one-location-to-another-with-javascript/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">960</post-id>	</item>
	</channel>
</rss>