WooCommerce: Retrieve Paid Orders Only

The wc_get_orders function is the recommended method for fetching orders in WooCommerce due to its flexibility, safety, and adherence to best practices. It offers several advantages over using custom WP_Query or database queries. It’s also HPOS compatible.

You can specify various arguments to filter orders based on properties like status (pending, completed, on-hold, etc.), customer (ID, email), date range, order IDs, payment method, total, custom fields and more.

Today, I’d like to talk about paid orders – at the moment there is no way to filter out free orders with a wc_get_orders parameter, so we need to find a workaround.

My solution uses the “payment_method” parameter, which accepts a payment method ID (cheque, bacs, afterpay, paypal, stripe, woocommerce_payments, ppcp-gateway, klarna_payments, etc. based on the payment gateway plugins you use). Clearly, an order that comes with a specific payment method is a paid order.

Unfortunately you can only select one payment method (as opposed to an array), so we also need to do some array merging. Enjoy!

Continue reading WooCommerce: Retrieve Paid Orders Only

WooCommerce Without Product Images

This is an edge case, however it may happen that a B2B business requires no product images and doesn’t want to use the WooCommerce image placeholder either (this shows on shop/category pages and the single product page when no featured image is added).

This interesting question was asked by a Club member in our private Slack channel, so I didn’t hesitate for a second and looked for a quick fix (2 lines of code). Enjoy!

Continue reading WooCommerce Without Product Images

WooCommerce: How To Set Up CRM & Email Marketing Integrations

Running an online store involves using multiple tools such as CRM and email marketing platforms. Connecting these systems together allows you to better segment your audience based on shopping behavior and send targeted email campaigns to nurture leads and drive conversions.

Unfortunately, WooCommerce doesn’t provide an easy way to integrate with these platforms out of the box.

In this post, I’ll walk you through the steps of connecting your WooCommerce store to top CRM and email service providers using the FuseWP plugin. You’ll learn how to automatically sync your customer data to your email list and assign tags and categories based on the products they purchase.

Continue reading WooCommerce: How To Set Up CRM & Email Marketing Integrations

WooCommerce: Send Cancelled Order Email to Customers As Well

As per the WooCommerce settings, “Cancelled order emails are sent to chosen recipient(s) when orders have been marked cancelled (if they were previously processing or on-hold)“.

What’s not 100% clear, however, is that this email notification goes out to admins only (and additional email addresses, if entered in the email settings). Which means, the customer receives no cancelled order notification. So, let’s change this, and let’s add the customer email address to the list of people that receives this WooCommerce email.

Continue reading WooCommerce: Send Cancelled Order Email to Customers As Well

WooCommerce: Send Pending Order Email Automatically

The “Customer invoice / Order details” WooCommerce email notification is often used for manually sending payment requests to customers – it’s not automatically triggered like other WooCommerce emails. You can access it from the individual order screen under the “Order Actions” section.

In certain cases, however, you’d want to make it automatic. And I don’t know why it’s not like that by default. So, let’s fix it: if you create a manual order from the backend, set it as pending, add some products to it and “Save”, the email notification will trigger on its own thanks to the snippet below. Enjoy!

Continue reading WooCommerce: Send Pending Order Email Automatically

WooCommerce: How to Implement AI Translation

Reaching customers globally can increase your WooCommerce website sales.

Besides, because your WooCommerce website can now operate in several countries, this reduces dependence on a single market and the risks associated with economic downturns and changes in consumer behavior.

To reach customers globally throughout the world, it is necessary to have a WooCommerce website that is available in their native language, as a huge percentage of online customers prefer to purchase products that are accompanied by information presented in their language.

This means you have to create a multilingual WooCommerce website, and AI translation may help you get there faster.

Continue reading WooCommerce: How to Implement AI Translation

WooCommerce: Show Rating @ WooCommerce Product Review Admin Email

When a WooCommerce customer posts a product review on the single product page, and “Comment must be manually approved” is enabled under WordPress dashboard > Settings > Discussion, the store owner gets an email notification so that they can approve / trash / spam such a review.

What you probably knew, is that the “WooCommerce product review” is – actually – a “WordPress post comment“, which means the email that the admin gets is the default “Please moderate: _____” notification that is also generated when a comment is submitted on a blog post.

Which… is really bad! And that’s because the email does not contain any sort of information regarding the WooCommerce product review, and especially the rating (“2 stars out of 5”). As a store owner, I definitely want to know whether the comment I’m about to moderate is (1) a product review and if (2) I need to reply to unfair feedback, so, let’s change that.

Here’s how to display the review rating in the “Please moderate: ____” admin email notification, when the comment is – of course – a WooCommerce product review. Enjoy!

Continue reading WooCommerce: Show Rating @ WooCommerce Product Review Admin Email

WooCommerce: “New Order” Email Recipient Based on Billing Country

The amazing thing about WooCommerce is that you can override any setting with a few lines of code. In today’s example we will try to code a solution where the “New Order” WooCommerce email will be delivered to a custom recipient based on the billing country.

This could be helpful when the WooCommerce store is managed by multiple people, and you want to make sure that order notifications only go to the right manager. Enjoy!

Continue reading WooCommerce: “New Order” Email Recipient Based on Billing Country

WooCommerce: Delete Customer After a Failed (Spam) Order

Once again, I’m trying to find WooCommerce anti-spam workarounds to avoid manual admin work like receiving hundreds of emails, deleting hundreds of fake orders and fake WordPress users.

In today’s “episode” I will try to clean the WordPress User database table after a failed order, because I’m really angry when “17PmU3MmKZS9ZAy7 17PmU3MmKZS9ZAy7” manages to register an account on Business Bloomer after a carding attack!

Please test this snippet on a dev/staging environment and not directly on the live site. Deleting a WordPress user is never a good idea, so you need to make sure everything is working as it should. Enjoy!

Continue reading WooCommerce: Delete Customer After a Failed (Spam) Order

WooCommerce: Limit Daily Sales For Cheap Products (Anti-Spam)

We could call this the “WooCommerce Anti-Spam Without a Plugin” series, while I attempt to fight against bad humans and very bad bots who love attacking the Business Bloomer checkout page with spam orders and fake user registrations.

My first attempts were (1) My Account registration anti-spam honeypot, (2) Checkout anti-carding-attack honeypot, and (3) Reducing the number of admin emails, but I can tell that (2) didn’t work, and I got another carding attack on a $9 product last weekend. Bots are smart.

Today, I’d like to share another anti-spam snippet that I’m currently testing on Business Bloomer. Most carding attacks, in fact, end up with the purchase of a single product in the $1-$9 range – which means that limiting the daily sales for specific, inexpensive, products may do the trick.

My code counts the times each product has been purchased during the day – and if a carding attack occurs, the product won’t be purchasable any longer until the end of the day. Because we’re talking about cheap products, it’s no problem for me to disallow legit sales as well for 24 hours. Use at your own risk, of course.

We already covered how to “Limit Sales Of A Product Per Day“, but this time I’d like to apply that to an array of products – and specifically all those that are under $10. Enjoy!

Continue reading WooCommerce: Limit Daily Sales For Cheap Products (Anti-Spam)

WooCommerce: 5 Minor Adjustments for Enhancing Product Images

In the fickle ecommerce industry, captivating product images can be the difference between a sale or a lost customer.

High-quality images have now become an invaluable asset for your online shop, as they can reel in shoppers, showcase your products uniquely and keep visitors engaged longer. And this is right where WooCommerce enters the picture – pun intended!

Armed with stellar features for optimizing product photos, WooCommerce plays an indispensable role in powering up your ecommerce site’s visual appeal.

In our upcoming discussion, we’ll dive deeper into how you can make these minor adjustments work wonders for your online business. Buckle up as we embark on this insightful journey through WooCommerce image optimization mechanism.

Continue reading WooCommerce: 5 Minor Adjustments for Enhancing Product Images

WooCommerce: Email Admin Upon Fatal Error

WooCommerce has a nice feature when it comes to WordPress Error 500 / Fatal Error – it logs the error and all the information regarding it inside the WooCommerce Status > Logs > Fatal Errors area.

My problem is that sometimes these errors occur in the backend, so they may not trigger the WordPress built-in email that notifies the admin about the problem.

What I want to try (please test it on your development website first, and not on your live website), is a way to get an email each time WooCommerce logs an error, so that I can go in and fix it immediately. Enjoy!

Continue reading WooCommerce: Email Admin Upon Fatal Error

WooCommerce: How to Level Up Your Email Marketing

In today’s competitive ecommerce landscape, email marketing plays a crucial role in connecting with customers and driving business growth.

With WooCommerce, you already have a powerful platform at your disposal to send and manage transactional emails effectively. However, when you need to send targeted marketing emails, additional plugins may be necessary. 

In this article, we’ll guide you through the process of optimizing your email marketing strategy using WooCommerce.

Whether you’re a seasoned email marketer or just getting started, we’ll explore actionable tips and practical techniques to help you level up your communication game.

So, let’s jump right in!

Continue reading WooCommerce: How to Level Up Your Email Marketing

WooCommerce: Bulk Re-Send All Customer’s Completed Order Emails

This is quite an uncommon WooCommerce requirement, but especially for downloadable products the Completed Order email is such as important one – and customers may end up asking you to resend them all their past order emails.

This is an interesting snippet, as it features important functionalities: getting orders by billing email, looping through the results and re-triggering the Completed Order email whenever a specific admin URL parameter is posted. Enjoy!

Continue reading WooCommerce: Bulk Re-Send All Customer’s Completed Order Emails

WooCommerce: Display Product Grid @ Order Emails e.g. Related Products

Bad news first – we’ve seen how to add content to any WooCommerce order email, however I did not specify that if you use the [products] shortcode that’s not going to work unfortunately. The reason behind this, in plain English, is that… it just doesn’t work, and it outputs a weird list of “Sale!” list items (see screenshot below)!

So, I want to fix this, and find a WooCommerce email-compatible way to show a grid of products based on a list of product IDs (for example, the list of related products based on the ordered items), and make sure I can actually see product images, titles, prices and a link. Enjoy!

Continue reading WooCommerce: Display Product Grid @ Order Emails e.g. Related Products

WooCommerce: Translate / Rename Content @ Order Emails

WooCommerce order emails customization is possibly the most wanted feature for WooCommerce store owners and developers right now. It is very difficult to edit the default templates and it’s no surprise there are many email customizer plugins out there.

We’ve already seen how to add content to specific WooCommerce emails, how to add custom email CSS, how to display product images, and more, but today I’d like to teach you a quick workaround to edit the default email text strings such as the initial greeting (‘Hi Mary,‘) or other sentences (‘We have finished processing your order.‘, ‘The following note has been added to your order:‘, ‘Just to let you know — we’ve received your order, and it is now being processed:‘, etc.).

With “edit”, of course, I mean either change the text, or completely hide it. So, let’s see how it’s done. Enjoy!

Continue reading WooCommerce: Translate / Rename Content @ Order Emails

WooCommerce: Resend Any Order Email

How annoying is the fact you can only resend the “New Order Notification” from the single order admin page? What if you’re testing out and customizing email templates, and need to email yourself the “processing” or the “completed” notification, without having to place a new test order or switching order status twice to re-trigger the notification?

Well, today we will see how to add a “Resend whatever email” function under the “order actions” on the single order edit page. Of course, make sure you switch the billing email to yours, otherwise the customer will get these emails and not you. Enjoy!

Continue reading WooCommerce: Resend Any Order Email