Chained Products, by StoreApps
The Chained Products plugin by StoreApps is a popular WooCommerce extension that allows store owners to bundle products together. When a customer purchases a “main” product, the plugin automatically adds all “chained” products to the cart. This functionality is incredibly useful for creating pre‑configured product bundles, free gift promotions, “Buy one get one” offers, and bundles that apply a specific bulk discount. However, a conflict can arise when an agent uses the Phone Orders for WooCommerce interface to create a manual order, because the phone order system may treat automatically added chained items as separate line items. This can lead to double counting or incorrect pricing.
The Phone Orders for WooCommerce plugin team provides a simple code snippet that resolves this issue. By attaching a small custom function to a dedicated developer filter, you can ensure that chained products are handled correctly, preventing double‑counting and preserving the intended bundle structure. This guide explains how the conflict manifests, provides the ready‑to‑use PHP solution, walks through the step‑by‑step integration process, and covers advanced customisation and troubleshooting options.
|
1 2 3 4 5 6 |
add_filter( "wpo_skip_add_to_cart_item", function ( $skip, $item ) { if ( ! empty( $item["chained_item_of"] ) ) { $skip = true; } return $skip; }, 10, 2 ); |
Choose where to add the code
You have two safe options for adding custom PHP code:
- Option A (Recommended): Use the free Code Snippets plugin. This is the safest approach. It allows you to add, activate, and deactivate code snippets without ever editing your theme files. You can install it from Plugins → Add New by searching for “Code Snippets”.
- Option B: Add to your child theme’s
functions.phpfile. If you are comfortable editing theme files, add the code to your active child theme’sfunctions.phpfile. Never add custom code directly to a parent theme, because it will be lost when the theme is updated.