Why Texas? People keep asking.

Cassie and I have for a while now been wanting to move out of Illinois, but for various reasons have stayed put here in Peoria. We’ve been pretty fortunate the past few years, which has put us in a pretty good position for finally moving. For us, it is obvious why Texas is the best choice but seeing as we do get asked pretty regularly “Why Texas” – it seems like a good reason for a blog post.

So to start with, some of the bigger reasons we are moving from Peoria. These are not the only reasons, there are a lot of reasons that built up to the desire to move, but these stand out especially.

Technology

Peoria is not so great for technology. People are trying, sure, but my own personal opinion is that while there are some very passionate people here who I would love to see succeed in making Peoria a more tech savvy place, I think the rest of Peoria simply does not care.

Travel

Maybe it is just me, but having an international airport that has zero international flights, and services nothing but regional planes that I do not fit in comfortably, is kind of sad. In the past few years I’ve flown around a bit more both for personal and business reasons, and fully expect this trend to continue upwards. Even to take a train I have to drive an hour away.

We do enjoy traveling around, and would like to continue to enjoy traveling. Unfortunately a lot of small things all build up into a larger issue of it is hard to travel from Peoria.

The Cold

I don’t care for the cold. Neither does Cassie. It’s not terrible, but it’s not enjoyable. Some people prefer cold over heat, but personally I can tolerate heat better than cold. Not to mention you don’t have to shovel heat out of your driveway after an extra hot day.

So, why Texas?

It was pretty easy to decide on Texas, pretty obvious to be honest. Imagine being untethered and having the ability to move anywhere you chose, then just funnel down the options from there.

We don’t plan to move to a new country, so we’re still in the United States, going further, we are sticking to the contiguous 48 states.

We are trying to find warmer weather, so we’re looking at the lower half the country.

I am ok with heat, but don’t enjoy humidity so much. So not the south-east.

Not California.

If you’re following along with your map up to this point all that is left is from the edge of California to the edge of the south-east. Really at this point it is a no brainer because who would enjoy living in a desert? Texas is the only good state to live in.

So, where in Texas?

Knowing that we are looking for easy travel and technology, that focuses our search to bigger cities in Texas. We removed Houston early on because it is still pretty close to the south-east, and that leaves Austin, San Antonio, and Dallas-Fort Worth.

At the end of the day of those three choices, we chose Dallas-Fort Worth. The combination of easy travel and the very tolerable winters and summers were major factors.

So, when?

Relocating like this it is a gamble with both buying and renting. On one hand renting is less risk, but at the same time houses in DFW keep getting more and more expensive. In some cases over $100,000 more in just a few years. We could buy a house and it could either continue to increase in value (win) or it could lose value. We’re betting on the housing market to continue to rise.

This will be our first home we buy, so not only are we relocating to a totally new state, we are getting our first mortgage at the same time. This has been a long process so far but we are finally to the point we are starting to look more seriously at houses, and could make a serious offer.

This means we could be moving in a month, could be a few months. It all depends on when the right house shows up for us.

WordCamp Dallas-Fort Worth Texas 2016 Belt Buckle

I’ve got my DFW belt buckle ready to go, DFW here we come.

PS: Texas has some great BBQ. Of all the BBQ, my favorite BBQ is Texas BBQ.

#BBQ

See you at WooConf 2016?

wooconf

Unfortunately, I was not able to make it to the first WooConf, but the next one is coming around the corner! Better yet, I will be there to talk about makeup scaling WooCommerce. I look forward to sharing my thoughts, experiences, and a bit of how we’ve been able to do what some claim cannot be done with WooCommerce.

I know some people have been considering NOT going to WooConf, and some are on the fence. So I’ve put together a quick list of a few top reasons to go. This is just what came to mind right away, there are tons more reasons to go, and this list may or may not be in a specific order.

  • I am speaking
  • Austin has some really great BBQ, and tacos.
  • You are going to learn a ton, not just devvy nonsense from developers like myself but a lot of great topics from some amazing speakers. Take a look at the speaker list and see for yourself.
  • Networking. Chances are if there is anything you are looking to do with your business related to WooCommerce or your website, someone at WooConf that you could talk to about it.
  • It’s not in San Francisco, so you don’t have to give up your first born child to go.

So I know I will be at WooConf this year, will you?

Gaug.es – My alternative to Google Analytics

Whenever someone is launching a website ususally they want to be able to know how many people are visiting it, what pages they are visiting, and where those visitors are coming from. Almos always the default answer to this is Google Analytics. Which is this insanely powerful analytics platform that can give you insights into just about every part of your website. For free.

Whenever something is very powerful, it tends to also get complex. So when Joe Site Owner wants to know “how many people visited my site today” there are some cases where this can be a hard number to get out of Google Analytics for those unfarmilar. I won’t even mention all the other seemingly basic pieces of data that require long paths of clicks just to get to the basic report, then having to drill down. Don’t get me wrong, Google Analytics totally has it’s place and for some sites it is totally worth it, on many though it is just overkill.

So, what now? Without the one go to analytics platform used by nearly everyone for almost everything, what do you use?

Personally – I use Gaug.es for sites where I do not need more advanced and complex analytics. They were previously a product owned by GitHub, if you need some validation before looking closer at them. Take a look at the screenshot below, it would be hard to create a simpler interface. An interface where you can login, and just get the data you are wanting right away.

gauges

It covers all the basics:
– Live Visitors
– Pageviews
– Unique Visitors
– Referring Sites
– Search Terms
– Geolocation

Then it has some more advanced tools which are really useful for developers. Screen sizes is fairly self explainatory, a breakdown of the resolutions of screens of your visitors. With this you can get a quick idea of how important say a responsive site would be to your visitors.

gauges-technologies

 

Technology is a bit cooler. To start with you can get a breakdown of the browsers and operating systems that your visitors are using, but it takes things one step further. You can at a glance see how many of your visitors browsers support various web technologies. I quickly know that if I wanted to use the canvas element on this site, it would be a safe move. However many visitors would have a hard time with the datalist element.

gauges-technologies-2

I’ve been using Gaug.es for quite some time now and have really enjoyed the simplicity of it. I’m not missing anything I would have wanted from Google Analytics for things like my personal blog, and I can check my analytics quite a bit faster too.

If you are using something other than Google Analytics for analytics, leave a comment below with what you are using.

Converting WooCommerce Upsells to Cross Sells

Cross sells… Upsells… What are they? What’s the differece? Why does it matter?

What are they?

The short version: Recommendations of additional products to purchased based on what you are looking at or about to purchase. An upsell being something better than what you have (a newer or better model… an upgrade), while a cross sell is something in addition or an accesory that goes with the product. You can find more about this on Chris Lema’s great post about upsells and cross sells.

Why does the difference matter?

To start with recommendations and how you display them may not make much of a difference to a store. So say you start adding them just in either the cross sells or upsells depending on how you feel that day. Then your store gets bigger. Now you have hundreds of products. You realize that you want to start focusing your upsells and cross sells a bit better and see the mess in front of you. Now you will need to manually edit every product and put upsells and cross sells into their rightful place.

Converting Upsells to Cross Sells via MySQL

Having recently cleaned up this exact scenario using MySQL I thought I would share the queries I wrote to do this. My goal:

Convert all current upsells (that are not empty) to cross sells.

Before continuing please make a backup of your database.

To get a lay of the land, I decided to see what I was working with. This first select query will pull all the existing cross sells, and the matching upsell, where the upsell is not an empty set.

select cs.meta_value as 'cross sell', us.meta_value as 'up sell' from wp_postmeta cs
join wp_postmeta us on cs.post_id = us.post_id and us.meta_key = '_upsell_ids'
where cs.meta_key = '_crosssell_ids' and us.meta_value != 'a:0:{}';

For me these results showed I had an empty cross sell for every single upsell. This makes life a bit easier, because I do not need to worry about overwriting my cross sells with up sells. However if I had run into a case like this, my next query I would have limited to update only cross sells that were empty as well.

This update query is a bit more advanced than just a standard select but mostly straight forward. On products which have upsells, copy that upsell data into the cross sells.

update wp_postmeta cs
join wp_postmeta us on cs.post_id = us.post_id and us.meta_key = '_upsell_ids'
set cs.meta_value = us.meta_value
where cs.meta_key = '_crosssell_ids' and us.meta_value != 'a:0:{}';

Success, we have copied our up sells to cross sells. Now, we have duplicate data. Our upsells and our cross sells are the same. Personally I do not like to make wide sweeping changes all at once, so I take baby steps. For how I work, I can take a step, check the results, double check the results, and then move to the next step. In my experience I’ve found if something ultimately does not work as expected it is easier to revert (outside of going and restoring a backup).

The process to empty all the upsells is even easier. Where the upsells are not empty, update it to an empty set!

update wp_postmeta us
set us.meta_value = 'a:0:{}'
where us.meta_key = '_upsell_ids' and us.meta_value != 'a:0:{}';

This worked well for me, and I hope is useful for you!

WooCommerce and Coupon _used_by Logging

So in WooCommerce (as of 2.3.x) every use of a coupon means another post meta is added to that coupon with the key _used_by. For sites that offer a single coupon for all of the general public to use, this can cause some issues in extreme edge cases. In our specific case we ran into an issue where the meta of a single coupon totaled 78.5k rows (at the time the post meta table included over 15,000,000 rows). At random without any changes to the site code or server configurations the site immediately started having degraded performance.

After a large effort on our end and the L3 support at WPEngine, they were able to trace back the performance to a looping of queries to the wp_postmeta table but were not sure why. It was tracked back to this line of code within WooCommerce.

https://github.com/woothemes/woocommerce/blob/master/includes/class-wc-coupon.php#L178

get_post_meta ultimately down the line trigger update_meta_cache to be called. The SQL query to pull post meta does not include the meta_key, because WordPress is built in a way that it will attempt to instead just make a single SQL query and cache the entire result. So when you call get_post_meta multiple times in a row for a single post, only one SQL query is actually triggered. At WebDevStudios, Brian Richards and I actually used this to our advantage after some discussion on the best way to store data on a project.

In almost any other use case the use of a single SQL query to pull all post meta and cache it works perfectly fine.

However, if you are using Memcache as an object cache you should know that any single piece of data stored by default has a maximum of 1MB in size. Our post meta for this single coupon just hit that 1MB limit and was not cacheable by Memcache anymore.

So, when WC_Coupon->populate() loops through all the meta keys of the coupon calling get_post_meta on each to populate the object, instead of one SQL query for everything it hits the database for every single call. This caused quite a bit more stress on the database causing response times to go from 10–25ms to nearly 200ms, per query, with nearly 15 queries for this specific coupon as well.

Update: There is now a GitHub issue (#8482) opened to look into this.