# How to Include Draft Products in WooCommerce Upsells
Want to offer upsells on your WooCommerce store but have some products still in the draft stage? Don’t worry, you’re not alone! Many businesses want to offer related items even before they’re fully launched. This article will guide you, step-by-step, on how to Check out this post: How To Use Woocommerce Shortcodes achieve this. We’ll cover both the easy, no-code method and a more advanced, code-based solution.
Why Include Draft Products in Upsells?
Including draft products in your upsells offers several advantages:
- Early Engagement: Get customers excited about upcoming products. Imagine a new limited-edition t-shirt – letting customers pre-order it and suggesting related accessories (even if those are still drafts) increases excitement and pre-orders.
- Improved Read more about Woocommerce Template Illustrator How To Conversion Rates: Offering relevant suggestions while the customer is already in a buying mood increases the chance of additional sales.
- Strategic Product Launches: Use upsells to generate hype and build anticipation for your new product releases. This creates a buzz even before the official launch.
- Test the Waters: See how customers react to the suggested products even before officially releasing them. This helps with fine-tuning product descriptions or pricing before the full launch.
Method 1: The Simple, No-Code Approach (Using Product Categories)
This method works best if your draft products share a category with your published products.
1. Organize your products: Ensure your draft products and their related published counterparts are categorized appropriately in WooCommerce. For example, if you’re selling a new “Blue Widget” (draft), make sure it’s under the “Widgets” category, alongside already-published widgets.
2. Set up upsells on published products: Go to a published product within the correct category. In the Product Data tab, go to the Linked Products section. Select the “Upsells” tab.
3. Add Upsells: You should see all products within the category, including your draft products. Select the relevant draft products to offer as upsells.
Example: If you sell “Red Widgets” and have a “Blue Widget” in draft, add the “Blue Widget” as an upsell to the “Red Widget” product page.
Method 2: The Code-Based Approach (For More Control)
This method requires adding code to your `functions.php` file or a custom plugin. This is recommended only if you’re comfortable with PHP coding. Check out this post: How To Use Woocommerce Filters Always back up your website before adding any code!
This code snippet modifies the `woocommerce_upsell_ids` filter to include draft products:
add_filter( 'woocommerce_upsell_ids', 'include_draft_products_in_upsells', 10, 2 ); function include_draft_products_in_upsells( $upsells, $product_id ) { $args = array( 'post_type' => 'product', 'post_status' => array( 'publish', 'draft' ), // Include drafts 'posts_per_page' => -1, // Get all products // Add any other relevant criteria here, e.g., category 'category' => 'widgets' // example );
$products = get_posts( $args );
foreach ( $products as $product ) {
// Add your logic to determine which draft products to include
// For example, only include draft products within the same category
if ( has_term( ‘widgets’, ‘product_cat’, $product->ID ) ) {
$upsells[] = $product->ID;
}
}
return $upsells;
}
This code adds all products (both published and draft) from the specific category “widgets” as potential upsells. Modify the `category` argument and the conditional `if` statement to match your specific needs.
Important Considerations
- Testing: Always test your upsells thoroughly after implementation. Check the frontend to ensure the draft products are displayed correctly.
- Customer Experience: Clearly indicate that the upsell product is a draft or pre-order. Manage customer expectations about availability.
- Product Management: Remember to publish your draft products once they’re ready. Keep your product categories updated for optimal results.
By following these methods, you can effectively leverage your draft products to enhance your WooCommerce upsell strategy and maximize sales opportunities. Choose the method best suited to your technical skills and remember to prioritize a seamless and informative customer experience.