You can find settings for child products by going to WooCommerce > Settings > Product Add-Ons > Products.
Include variations as child products
If you’re using the ‘Products’ field, you might want to include variations as child products, not just simple products.
To do so, go to WooCommerce > Settings > Product Add-Ons and select the ‘Include variations as child products’ option:
Display variant name without SKU in child product
By default, when using variations as child products, product names include the SKU. If you’d like the name without the SKU, go to WooCommerce > Settings > Product Add-Ons > Products and enable ‘Exclude SKUs from child variants’
Hide child or parent products in the cart, order or email
If you’d like to hide child products in the cart, order page and emails, you can go to WooCommerce > Settings > Product Add-Ons and select the following two options:
- Hide child products in the cart
- Hide child products in the order
This will also ensure that the count of products in the mini cart is updated.
Hide parent products in the cart, order and email
If you’d like to hide parent products instead, just check the following options
- Hide parent products in the cart
- Hide parent products in the order
Display child products as metadata
If you’d like to link child products to the parent product, you can display the child product IDs in the parent product metadata.
Multiply child product quantities by the product quantity
If you would like to multiply the quantity of child products by the main product quantity:
- Go to WooCommerce > Settings > Product Add-Ons > Products
- Set ‘Multiply independent quantities’
Redirect hidden products
You can ensure that child products are not purchasable independently by setting them as ‘Hidden’ then checking the option to ‘Redirect hidden products’.
Display child product information in a lightbox
You can display additional information about child products when a user clicks the child product title. This will display the product title, thumbnail and short description in a lightbox.
To enable this, check the option to ‘Enable QuickView for child products’.
Note that this only works with ‘Checkboxes’, ‘Column’ and ‘Radio’ layouts.
List parent and child items separately in the cart
If you don’t want to organise child products under their parent products, you can use this snippet:
<?php | |
/* | |
* Don't organise child products under parent products | |
*/ | |
remove_action( 'woocommerce_cart_loaded_from_session', 'pewc_cart_loaded_from_session' ); | |
remove_filter( 'woocommerce_cart_item_remove_link', 'pewc_cart_item_remove_link', 10, 2 ) |
Edit child product quantities in the cart
By default, the child product quantities can’t be edited in the product page, if you’ve set the product field quantity settings to Independent.
If you’d like users to edit child product quantities in the cart page, then use this snippet:
<?php | |
// Editable child quantity in cart when set to independent | |
add_filter('pewc_disable_child_quantities', '__return_false'); |
Here’s how to add a snippet.