Posted on January 14, 2016 by Patrick

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?

Posted on January 13, 2016 by Patrick

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.

Posted on October 8, 2015 by Patrick

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!

Posted on June 29, 2015 by Patrick

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.

Posted on April 15, 2015 by Patrick

Extensions: The Good, The Bad, The Ugly.

Over the past few years there has been a growth of companies using the “plugins as a platform” type model. They will offer up their core plugin for free, and then monetize it with paid extensions. WooCommerce is the most notable in this market, but there are others. Easy Digital Downloads and Ninja Forms are two plugins that also do this that I use quite a bit.

Disclaimer: I have developed a number of extensions (free & paid, public & private) for a number of platforms – including all the ones listed today.

The Good.

For the user, this is (usually) a really great thing. They get their core functionality for free and then just pay for the features they need. If they want to add a recurring subscription to their shop later, they just buy that extension and drop it in. Hard to beat the simplicity of that isn’t it?

There are always haters and of course this feels like nickle and diming when you end up “needing” (read: wanting) a lot of features on your site. Honestly – that’s all I chalk that up to as long as the extensions are reasonably priced. Don’t want to pay for $500 in extensions that build 90% of your site without having to hire a developer? I can understand being cash strapped when getting started but please at least respect the amount of development that has gone into all the plugins you are using. Chances are if you had to build that site from scratch you are looking at a 5–6 figure estimate. How’s that $500 in plugins sounding now? 🙂

The Bad.

For all the plugins as a platform type marketplaces out there, I don’t think there are any that do not have third party developers buiding the extensions. Next time you go to buy an extension look around for a “Developer” name listed on it. It may or may not be the company you think you are buying an extension from. This is not by itself an entirely bad thing… there are some amazing developers out there and they do not have to work for the core plugin to be amazing. I am not including this fact as something that is “bad” in itself, it can actually be great. It is something to be aware of though and is not always totally clear to the uninformed.

What this can lead to though is a semi-political environment and a number of “got there first” situation. The reason for this is obviously the best place to sell your extension is on the website of the plugin itself, you get the most exposure and the best sales there. To avoid confusion these sites are not going to sell two extensions that do the same thing. So usually regardless of quality or what is “better” (of course that is totally relative). Unless something really messes up or breaks if someone else has built an extension, you need to find somewhere else to sell it.

The typical extension marketplace uses Trello as a place to manage all the extensions. Usually “claiming” an extension is a matter of creating a card and assigning your name to it. At that point unless you take too long to build it or are unresponsive someone else cannot just come in and build the same thing and have theirs sold in place of yours… again regardless of quality.

In all cases of selling extensions on the core plugin’s website all of the code is in initially audited and held to certain standards. This does not include the likes of CodeCanyon or other marketplaces where you can just upload whatever and good or bad it can likely sell.

The takeaway here is, just because you are buying from “the people who made the core plugin” that does not mean you are getting the same developers for your new extension. Sometimes you do, sometimes you don’t, just be sure you know what you are buying.

The Ugly.

It’s hard to find a nice way to say this next piece.

Some extensions are total garbage.

As an average consumer the typical extension purchase involves reading the title and description and if it sounds like it does what they want they may get it. Sometimes this invovles looking at documentaiton, watching videos, reading reviews.

Having been in that mindset and knowing a number of developers who build extensions I see varying levels of though put into the code. You have the ones that want to build the best product and it becomes very obvious. There are others who want to find the extension that they can do the least work on and it sell high volumes.

The good news here is usually with larger marketplaces there is some sort of refund policy. If shortly after you buy an extension it turns out to be horrible you can possibly get a refund. Smaller shops seem to do this much less.

The ugly part of this is, usually the consumer buying an extensions does not know what good or bad code is. They usually do not find out there is an issue until they have issues or the site gets large enough that they work with a developer to further grow their site, and these extensions start creating limitations and more issues than they are worth.

My Point.

For small projects or something you just need to get off the ground, an extension can be great. If you have plans to really grow a site and you want to make the most of your time and money investment into a site… work with a developer to plan that out and decide what features of yours can be accomplished with a trusted extension, and what features you want specific enough functionality that it makes more sense to develop your own from scratch.

The last thing you want to do is become succesfull and find out your site is getting in your way of your success. Dealing with growth pains of rapid success can be hard enough, you really don’t want to also end up having to rebuild half your site at the same time!

Older Posts