WooCommerce Performance: Indexing the post_modified_gmt column
WP Theming
by Devin
2y ago
WooCommerce 5.8 added support for `modified_before` and `modified_after` params when querying to the REST API for products, orders and coupons in the in the REST API endpoints. Here’s the PR that was merged. This is great as lots of external services use the REST API to fetch data, and this allows them to just fetch data that has changed since the last sync. However, if you have a really large... Source ..read more
Visit website
WooCommerce Performance: Using post_author to store order customer IDs
WP Theming
by Devin
2y ago
WooCommerce stores order records in the `posts` table as a `shop_order` post type. The majority of data associated with the order, such as the order_total or billing and shipping information is stored in the `postmeta` table. This works fine in most cases, but once a WooCommerce shop scales past ~1 million orders, queries of postmeta can start to run long. If WordPress needs to get a specific... Source ..read more
Visit website
Rebuilding a WordPress Site in Phases
WP Theming
by Devin
2y ago
Ever since I started working at Universal Yums, I’ve wanted to rebuild the theme. Over its six years of existence style overrides had been layered on top of each other making new development really difficult. Javascript was mostly in one massive file. The build system was outdated and clunky. However, rebuilding a site that’s still in very active development and has thousands of customers a day is... Source ..read more
Visit website
Partial Database Restores From a Backup
WP Theming
by Devin
2y ago
So maybe you accidentally deleted 600,000 customer records and associated usermeta from a WordPress site. Or maybe I did. Regardless, it’s a problem and they now need to be restored. Thankfully, there’s a backup (boy howdy, you better hope so). Our site is hosted with WP Engine, so we restored a snapshot from before the accidental deletion to a new environment. We hadn’t deleted all the user... Source ..read more
Visit website
WP CLI Scripts and WooCommerce
WP Theming
by Devin
3y ago
If you manage a WooCommerce store, you’ll like need to bulk update or modify a large number of orders, subscriptions, products or customer records at some point. Writing a WP CLI script can be a quick and easy way to do this. In this video I show how to export products into a CSV using WP CLI and the command wp eval-file, but the general concepts can be used to loop over any resource you may want... Source ..read more
Visit website
Managing Fraud Orders in WooCommerce
WP Theming
by Devin
3y ago
One morning I woke up to find 20,000 new fraudulent orders on a WooCommerce site I manage. The vast majority of them were in failed status, but a few had successfully completed. We quickly determined this was a card testing attack, where a fraudster was using an automated system to iterate through a huge amount of stolen credit card numbers to check out on our site and determine which ones were... Source ..read more
Visit website
Deleted Laravel Logs Eating Up Disk Space
WP Theming
by Devin
3y ago
We had an odd situation where disk space was getting swallowed up on a Digital Ocean server running Laravel. The issue started happening after an upgrade from Laravel 7 to Laravel 8 (though it could have been there before unnoticed). The database size had been growing, so my first though was just to resize the droplet. But when an additional 100GB was eaten up over the weekend I realized there... Source ..read more
Visit website
How to Avoid Excess Meta with WooCommerce Subscriptions
WP Theming
by Devin
3y ago
Orders in WooCommerce create a lot data in the postmeta table. There’s the standard WooCommerce fields (like _order_key, _cart_hash, _billing_first_name, etc.), but payment gateway plugins, marketing integrations, and other WooCommerce plugins also generate their own metadata. It’s not unusual to see more than 60 rows of metadata for each order. I recommend the Post Meta Inspector to easily view... Source ..read more
Visit website
Update the Modified Date in a WooCommerce Order
WP Theming
by Devin
3y ago
If you run a script to update order properties in WooCommerce, you may want to update the “post_modified” date along with the other updates. Many third-party integrations rely on the post_modified date to sync any order changes or updates. Here’s how you can easily update the modified date (assuming you have the order object): Here’s a full example which fetches the order, updates the date... Source ..read more
Visit website
TablePlus for SQL Queries in WordPress
WP Theming
by Devin
3y ago
Having a nice GUI to make direct database queries can be really helpful when working with a complex WordPress site. TablePlus is the best one one I’ve found for the Mac. Connecting to a local database and most remote databases should be pretty straightforward, but there’s a few extra steps if the database is hosted with WP Engine. WP Engine has remote database access instructions here. Source ..read more
Visit website

Follow WP Theming on FeedSpot

Continue with Google
Continue with Apple
OR