Category: WooCommerce

  • WooCommerce Performance: Indexing the post_modified_gmt column

    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 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

    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

    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

    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

    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…

  • Launching an Extension in the WooCommerce Marketplace

    Launching an Extension in the WooCommerce Marketplace

    I launched an extension in the WooCommerce Marketplace! It’s been three years since I came up with the initial idea and it’s exciting to see it being sold on WooCommerce.com. For anyone interested in selling WooCommerce products, I wanted to share some thoughts on the process. Coming Up With A Product The extension idea originally…

  • Example Cart Restrictions in WooCommerce

    Example Cart Restrictions in WooCommerce

    I’ve been working with a “Trial Product” in a WooCommerce store which needs to be the only item in the cart during checkout due to shipping requirements (and because it doesn’t make sense to order a trial if you’re also going to order the actual product). To make this clear to the customer, I’ve restricted…