How to Allow Orders for Out-of-Stock Products on WooCommerce: A Complete Guide
Introduction:
WooCommerce is a powerful e-commerce platform that allows you to easily set up and manage your online store. By default, WooCommerce prevents customers from adding products to their cart when the stock level reaches zero. While this protects you from overselling, it can also lead to lost sales and customer frustration, especially if you offer made-to-order items, pre-sales, or have a reliable system for quickly replenishing your inventory. This article will guide you through different methods on how to place an order out of stock on WooCommerce, exploring the pros and cons of each Explore this article on How To Delete A Plugin From WordPress Woocommerce approach so you can make the best decision for your business. We’ll cover everything from simple setting changes to custom coding solutions.
Allowing Backorders: The Built-In WooCommerce Option
The easiest way to allow customers to order out-of-stock products is by utilizing WooCommerce’s built-in backorder functionality. This feature lets you accept orders even when the item is currently unavailable, informing the customer that their order will be fulfilled at a later date.
Enabling Backorders on a Per-Product Basis
This is the recommended approach if you only want to allow backorders on specific items. Here’s how to enable it:
1. Go to your WooCommerce Products: In your WordPress admin dashboard, navigate to “Products” > “All Products.”
2. Edit the Product: Find the product you want to allow backorders for and click “Edit.”
3. Navigate to Inventory: In the Product Data meta box, click on the “Inventory” tab.
4. Manage Stock: Ensure “Manage stock?” is checked. If it’s not, enabling backorders won’t work correctly.
5. Backorders Setting: Find the “Backorders?” dropdown and choose one of the following options:
- “Do not allow” (Default: Orders are not allowed when out of stock)
- “Allow, but notify customer” (Recommended: Orders are allowed, and the customer Discover insights on How To Add Woocommerce Free Download Product is informed that the product is on backorder.)
- “Allow” (Orders are allowed without any notification.)
6. Update Product: Click the “Update” button to save your changes.
Setting a Global Backorder Option
While less flexible, you can configure a global backorder setting for all your products. This can save time if you want to allow backorders for most or all of your inventory.
1. Go to WooCommerce Settings: In your WordPress admin dashboard, navigate to “WooCommerce” > “Settings.”
2. Navigate to Products: Click on the “Products” tab.
3. Navigate to Inventory: Click on the “Inventory” tab.
4. Out of stock visibility: Ensure “Hide out of stock items from the catalog” is unchecked to allow customers to even see out of stock items.
5. Stock Options: Scroll down to the “Stock options” section.
6. Out of Stock Threshold: Set a value here to indicate when a product becomes out of stock. Usually this is 0.
7. Backorders: Choose your desired global backorder setting from the “Backorders allowed?” dropdown (same options as per-product).
8. Save Changes: Click the “Save changes” button.
Allowing Orders Without Stock Management
Another approach is to disable stock management entirely for specific products. This is suitable if you don’t need to track inventory accurately.
1. Go to your WooCommerce Products: In your WordPress admin dashboard, navigate to “Products” > “All Products.”
2. Edit the Product: Find the product you want to disable stock management for and click “Edit.”
3. Navigate to Inventory: In the Product Data meta box, click on the “Inventory” tab.
4. Uncheck “Manage Stock?”: Uncheck the box next to “Manage stock?”.
5. Update Product: Click the “Update” button to save your changes.
With stock management disabled, customers will be able to order the product regardless of its “stock status,” effectively making it always available.
Custom Code Solutions
For more advanced control, you can use custom code to modify WooCommerce’s behavior. This is best for developers or those comfortable with code editing. Always back up your website before making any code changes!
Allowing Add to Cart Regardless of Stock (Simple Snippet)
This snippet will bypass the stock check and always allow the “Add to Cart” button to appear, even when the product is out of stock. Add this to your theme’s `functions.php` file or use a code snippet plugin.
add_filter( 'woocommerce_is_purchasable', 'always_purchasable', 10, 2 ); function always_purchasable( $is_purchasable, $product ) { return true; }
Explanation:
- `add_filter()` hooks into the `woocommerce_is_purchasable` filter, which determines if a product can be added to the cart.
- `always_purchasable()` is a custom function that always returns `true`, overriding the default stock check.
Adding a Custom Notice on Out-of-Stock Products (More Advanced)
This snippet combines allowing out-of-stock orders with a custom message to the customer. This is useful for transparency.
add_filter( 'woocommerce_is_purchasable', 'allow_outofstock_purchase', 10, 2 ); add_filter( 'woocommerce_get_availability', 'wcs_oos_availability', 20, 2 ); function allow_outofstock_purchase( $purchasable, $product ) { if ( ! $product->is_in_stock() ) { $purchasable = true; } return $purchasable; }
function wcs_oos_availability( $availability, $_product ) {
if ( ! $_product->is_in_stock() ) {
$availability[‘availability’] = __(‘Available on backorder’, ‘woocommerce’);
}
return $availability;
}
Explanation:
- `allow_outofstock_purchase()`: Makes out-of-stock products purchasable.
- `wcs_oos_availability()`: Changes the availability message to “Available on backorder” when the product is out of stock, clearly informing the customer.
Pros and Cons of Each Method
Choosing the right method depends on your specific business needs. Here’s a summary:
- Backorders (Built-in):
- Pros: Easy to implement, built-in functionality, allows customer notification.
- Cons: Requires stock management, relies on you fulfilling backorders.
- Disable Stock Management:
- Pros: Simplest solution if you don’t need stock tracking, always allows orders.
- Cons: No stock level information, potential for overselling if you’re not careful.
- Custom Code:
- Pros: Highly customizable, allows for specific logic and notifications.
- Cons: Requires coding knowledge, potential for conflicts with themes or plugins, needs maintenance.
Conclusion: Choosing the Right Approach
Deciding how to place an order out of stock on WooCommerce requires carefully considering your business model, inventory management capabilities, and customer expectations. If you track inventory accurately and can fulfill backorders reliably, the built-in backorder feature is the best option. If you don’t need to track stock, disabling stock management might be simpler. For advanced customization and specific requirements, custom code provides the most flexibility. Remember to clearly communicate your fulfillment policies to your customers, regardless of the method you choose. Transparency is key to building trust and ensuring customer satisfaction. Finally, always test your chosen method thoroughly before rolling it out to your live site.