# How to Include Draft Products in Linked Products (WooCommerce) – A Beginner’s Guide
Want to link draft products in WooCommerce? It might seem impossible, but with a few tweaks, you can easily achieve this. This guide will walk you through the process, perfect for beginners who are new to WooCommerce’s intricacies.
Why Link Draft Products?
Before diving into the *how*, let’s understand the *why*. Linking draft products in WooCommerce offers several advantages:
- Organized Pre-Launch Planning: You can plan your product relationships – upsells, cross-sells, and related products – *before* the products are fully launched. This streamlines your workflow and prevents last-minute scrambling.
- Improved Workflow Efficiency: Avoid manually updating linked products after launching new items. Set it up once, and it’s done.
- Faster Product Launches: Reduce launch day stress by having all your product connections pre-configured.
The Challenge: Draft Products are Hidden
WooCommerce, by default, hides draft products from the main product selection area where you link products. This prevents accidental linking of unfinished products to live, visible products. That’s a good thing for preventing mistakes, but it creates a hurdle if you want to plan ahead.
The Solution: Directly Accessing the Product ID
The key is to bypass WooCommerce’s default interface and directly use the product ID. Every product in WooCommerce, whether draft or published, has a unique ID number.
Finding the Product ID
1. Locate your draft product: Go to Products > All Products in your WordPress dashboard.
2. Find your draft product: Filter by status to “Draft” if necessary.
3. Check the product ID: The ID is typically visible in the URL when you edit the product (e.g., `yourwebsite.com/wp-admin/post.php?post=123&action=edit`. “123” is the product ID). You can also find it in the list view by hovering over the product.
Method 1: Using the WooCommerce “Linked Products” Meta Box (Manual Entry)
This method requires manually entering the product IDs. It’s best for a small number of draft products.
1. Edit the Product: Go to the product you want to link *to* your draft product.
2. Locate the “Linked Products” Meta Box: This is usually found under the “Product data” section.
3. Enter the Product ID: In the “Linked Products” field, type the ID of your draft product.
4. Save Changes: Update your product.
Example: Let’s say your product “Blue Widget” (ID: 456) is live and you want to link it to your draft product “Red Widget” (ID: 789). You would enter “789” into the “Linked Products” field for “Blue Widget”.
Method 2: Using a Plugin (for Bulk Linking)
For managing many draft products, a plugin can automate the process. Many plugins provide advanced product management features, including the ability to link draft products. Search for plugins like “Advanced Product Management” or “WooCommerce Product Links” in your WordPress plugin directory. Check reviews and compatibility before installing.
Method 3: Using Custom Code (Advanced Users)
If you’re comfortable with PHP, you can modify WooCommerce’s code to display draft products in the linked products meta box. This is advanced and requires careful consideration, as incorrect code can break your website.
This example requires using a filter and is not recommended unless you are comfortable coding in PHP.
add_filter( 'woocommerce_product_get_children', 'include_draft_products_in_linked_products', 10, 2 ); function include_draft_products_in_linked_products( $children, $args ) { if ( isset( $args['type'] ) && $args['type'] == 'linked' ) { $args['post_status'] = array( 'publish', 'draft' ); } return $children; }
Remember: Always back up your website before implementing any custom code.
Conclusion
Linking draft products in WooCommerce is achievable, even for beginners. By understanding product IDs and choosing the appropriate method – manual entry, a plugin, or custom code – you can efficiently plan and manage your product relationships well before your products go live. Remember to choose the method that best suits your technical skills and the scale of your project.