-

·
Code Snippet: Remove the Cart from the Storefront Theme Header
The cart is hooked in using the storefront_header action. To remove it: If you’d like to remove it from just the home page (or other specific pages), you can use a conditional statement:
-

·
How to Dequeue Scripts and Styles in WordPress for Improved Page Speed
Many WordPress plugins load scripts and styles on every page of a website even though they may just be needed on a few specific pages. For example, WooCommerce loads at least 3 scripts and 4 styles on every page, even if ecommerce functionality (like a cart or products) aren’t shown on those pages. I recently…
-

·
WooCommerce Performance: Indexing the post_modified_gmt column
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…
-

·
WooCommerce Performance: Using post_author to store order customer IDs
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…
-

·
WP CLI Scripts and WooCommerce
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…
-

·
Managing Fraud Orders in WooCommerce
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…
-

·
How to Avoid Excess Meta with WooCommerce Subscriptions
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…
-

·
Update the Modified Date in a WooCommerce Order
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…