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: Limit Sales Of A Product Per Day

Yes, “manage stock” is a nice feature to make sure you don’t oversell a given product based on the stock you have in your warehouse. However, what if you also need to have a “daily sales limit” – say you can’t sell more than 3 of a given product ID in a given day?

This is an interesting functionality that is also helpful for you to learn how to get today’s orders, how to loop through the orders to find a specific product ID and sum its quantities, and finally how to use the woocommerce_is_purchasable filter to set if a product can be purchased or not (which means, the add to cart may or may not show). Enjoy!

Continue reading WooCommerce: Limit Sales Of A Product Per Day

WooCommerce: Get Order Fees Total

It’s official – there is no way to get the fees total from an order with a simple PHP getter (not sure why – you can get lots of values such as totals, addresses, dates, URLs with one line of code except for this basic thing!).

So, we’ve got to fix this. Let’s say you have access to the $order object (on the thank you page, in the WordPress dashboard, inside an order email, etc.); here’s a few lines of PHP you can use to calculate the total amount of order fees. Enjoy!

Well, there is actually one line of PHP you can use to calculate the order total fees (despite I didn’t think so while I was writing this post) – I’ve now added it to the list of order “getters” here (where you can get lots of order values such as totals, addresses, dates, URLs with one liners).

So, in order not to waste this post, you still find below the original way to calculate order total fees (by looping through all order fees and adding up totals), as well as the one liner that can help you save time. Enjoy!

Continue reading WooCommerce: Get Order Fees Total

WooCommerce: Item Custom Field @ Edit Order Page

Alright, this title may not really help you understand what I mean, so let’s put it in another way. When, as an administrator, you edit an order and are in the Order Items table, you have the chance to edit the item quantity, subtotal and discounted price (see screenshot below).

Now, what if you also want to have the freedom to display and edit another custom field, so that it is saved inside the order once you hit the “Save” button?

This could be useful for custom setups – for example let’s imagine the admin has the necessity to also define the “shipped quantity”, so that they know exactly if a specific order has been entirely fulfilled or requires a second shipment to get completed.

Either way, see the screenshot below, play with the snippet, and see how it goes. Enjoy!

Continue reading WooCommerce: Item Custom Field @ Edit Order Page

WooCommerce: Bulk Replace Product Inside Existing Orders

Manual operations are always a nightmare for WooCommerce store owners. Thankfully, a bit of code can help and actions that would normally take hours can be executed in a few seconds via PHP.

Today, we’ll take a look at a very edge case, but this can still be helpful to understand the code and re-adapt it to other scenarios. If as a store owner you tend to replace products or product lines, it’s possible that you may need to replace the old products with the new ones inside existing orders, retroactively.

It’s a one-off operation that could take hours if it had to be done manually, based on the number of existing orders. With this simple snippet, however, you can edit an unlimited number of orders, and let the code replace ordered items. So, let’s see how this is done. Enjoy!

Continue reading WooCommerce: Bulk Replace Product Inside Existing Orders

WooCommerce: Add Custom Meta Box @ Order Admin

When you edit an order as an admin, you’re presented with the usual WooCommerce layout: order details on the left, order action on the right, the list of order items on the bottom left, and – possibly – additional meta boxes added by third party plugins (e.g. the PDF Invoice and Packing List plugin order meta box where you can define the invoice date and number).

On top of that, it’s also possible, of course, to define our own custom meta boxes, so that the administrator and/or shop managers can view (or even enter) additional information.

I’ve used it on a client website to show a custom field, but you can print anything you wish – even documentation for shop managers (how to complete the order for example).

So, here’s how we add a new “section” (meta box) to the single order edit page in the WordPress dashboard, and how we display some content in it. Enjoy!

Continue reading WooCommerce: Add Custom Meta Box @ Order Admin

WooCommerce: Disable Emails For a Single Order

This is a cool customization that can come useful for WooCommerce store admins, especially when they do manual order status changes via the Orders admin page.

As you know, each order status change triggers an order email (“processing”, “completed”, “on-hold”, etc.), and sometimes the store manager doesn’t want to resend them after each edit.

In this quick tutorial, we will see how to add a checkbox to the single order edit page, so that emails are disabled as long as the checkbox is kept checked. Enjoy!

Continue reading WooCommerce: Disable Emails For a Single Order

WooCommerce: Get Current User Orders By Status

This is a neat custom function that you can use in your WooCommerce customization. It can be helpful to know the list of orders placed by the current user ID, for example, if they are in their “My Account” page and you have a custom tab where you want to show e.g. only failed orders. Sooner or later this is something you’ll need. Enjoy!

Continue reading WooCommerce: Get Current User Orders By Status

WooCommerce: File Upload Plugins For Order Personalization

One of the biggest mistakes you can make as a WooCommerce store owner is offering limited product customization abilities. Product personalization is a critical component of online shopping that helps provide a better customer experience and results in a high retention rate.

75% of customers appreciate businesses that offer personalized offerings, and a Deloitte consumer review suggests that 1 in every 5 customers are willing to pay 20% more for a custom-designed and personalized product. 

A great way to do this is by offering an image upload solution for products for your customers to improve customer satisfaction and generate more revenue for your store. 

This article shows the top solutions that make uploading images for products for customers a breeze and enhance their customization abilities. But before we get into them, let’s look at more benefits of offering this capability in your store and how it affects your business bottom line. 

Continue reading WooCommerce: File Upload Plugins For Order Personalization

WooCommerce: View Thank You Page @ Order Admin

I’ve been testing for over an hour but finally I found a way to make this work. When you are in “Edit Order” view under WordPress Dashboard > WooCommerce > Orders, there is a dropdown of “Order actions”: “Email invoice”, “Resend new order notification”, etc.

A major problem I’ve always had while troubleshooting or working on the WooCommerce thank you page was that I had to build that URL by hand in order to view it again or to avoid placing yet another test order (it follows the format e.g. https://example.com/checkout/order-received/214008/?key=wc_order_aHB6YrmLOZIKP).

Well, from today, you can access that order thank you page URL directly from the “Order actions” dropdown. Enjoy!

Continue reading WooCommerce: View Thank You Page @ Order Admin

WooCommerce: Create An Order From Another Website!

This is going to be a great tutorial. And it works for sure, because I’ve just implemented it on the brand new WooWeekly website!

Basically I was looking for a way to create an order on Business Bloomer WooCommerce website when a customer registered from the My Account page on the WooWeekly WooCommerce website. The reason for doing that is that I’m using email marketing on Business Bloomer, and the only way to add an email contact from another website was by using the “REST API” that WooCommerce provides.

Now, I learned all this today, so you can manage to achieve complex stuff too. I’ll just save you a couple of hours of headaches trying to figure out how the system works – that’s why you’re here!

So, how do you create a WooCommerce order on one website when an event occurs on another website? Enjoy!

Continue reading WooCommerce: Create An Order From Another Website!

WooCommerce: How To Print Orders Automatically

If 2020 taught us anything, it was that businesses needed to stay nimble and find new ways to adapt. During the pandemic many businesses turned to WooCommerce as digital transformation was accelerated overnight out of necessity. Traditionally in-person shops selling anything from food to clothing to auto parts needed an online presence to continue selling in a safe and convenient way.

Developers, agencies and business owners (like yourself) worked very quickly as demand surged to fill in feature gaps for these new use cases in WooCommerce. 

A clear problem started to occur for businesses fulfilling orders in real-time. Knowing when the order was placed and starting the order fulfillment process was manual, slow and not organized. This resulted in increased time for employees to manage orders, errors in orders and delays getting orders to customers quickly.

And here comes Cloud Printing to the rescue. Adding such a system to your WooCommerce store can immediately cut manual steps in the post-purchase fulfillment process resulting in many benefits for your business.

You can expect reduced operations costs, increased employee efficiency and happiness while also increasing customer satisfaction by getting the order in customers hands quicker. So, let’s understand cloud printing better and see how this can be implemented. Enjoy!

Continue reading WooCommerce: How To Print Orders Automatically

WooCommerce Database Explained: How It Works and Where To Find Data

The term “database” is widely used and known to millions of people, but the proportion of people who have it in their vocabulary without understanding what it describes is sizable.

Databases are at the core of so many digital services today that it is easy to overlook them entirely, but whether you run a shopping site or a business server, building an understanding of them is worthwhile regardless of whether or not you are directly responsible for administration duties.

Having a grasp of the underpinnings of what a database is and how it works is sensible, especially if you run a WooCommerce site and you want to make optimal use of all that this platform has to offer.

To that end, here is an overview of the database fundamentals to bring you up to speed.

Continue reading WooCommerce Database Explained: How It Works and Where To Find Data

WooCommerce: Update Order Field Value After a Successful Order

We’ve already seen how to update user meta after a successful order, but this time our goal is to “correct” or “edit” a checkout field value after the order is placed.

You could for example add a phone number prefix if it’s not there, and by doing so, correct the phone number before sending it to your courier. Likewise, you could remove punctuation, trim spaces, format accents, and do any manipulation you desire on whatever order field.

So, here’s how they do it. Enjoy!

Continue reading WooCommerce: Update Order Field Value After a Successful Order

WooCommerce: Show SKU @ Cart, Checkout, Order & Emails

When SKU matters to the end user, displaying it in the Cart page, Checkout page, Thank you page, My Account View Order page and Order Emails under the item name is a must.

Ideal for B2B businesses and international brands, this simple customization can help you learn how to add any sort of content under the Cart/Checkout/Order item names. Simply use the same hook and try “getting” something different than SKU with this guide. Enjoy!

Continue reading WooCommerce: Show SKU @ Cart, Checkout, Order & Emails