Booster Plus, by Algoritmika Ltd
The Phone Orders for WooCommerce plugin works seamlessly with the Booster Plus for WooCommerce by Algoritmika Ltd, a comprehensive all‑in‑one toolkit that adds advanced discounting and dynamic pricing rules to your store. However, a known compatibility issue can occur: certain discounts may be applied multiple times — once for each product added to the cart — leading to incorrect order totals.
This guide explains why the problem occurs and provides a ready‑to‑use PHP solution that ensures discounts are calculated correctly for phone orders.
Understanding the Conflict: Why Are Discounts Applied Multiple Times?
Booster Plus for WooCommerce includes powerful modules for dynamic pricing, such as bulk discounts, role‑based pricing, and product‑specific sales. In a standard WooCommerce checkout, these modules typically calculate the discount once and apply it to the entire cart.
When an agent builds an order using the Phone Orders interface, each product is added to the cart as a separate line item. Without intervention, Booster Plus may interpret each addition as an independent transaction and apply the discount repeatedly — once for every product added. This results in a total discount that is several times larger than intended (e.g., a 10% discount might be applied three times on a three‑item order, giving an effective 30% reduction).
The code snippet provided by AlgolPlus resolves this issue by normalising the product cost for every line item that has not been manually overridden by the agent.
The Solution: A Single PHP Snippet
Insert the following custom code into your site to prevent discounts from being applied multiple times for each product added via the phone order interface.
|
1 2 3 4 5 6 7 |
add_filter( "wpo_prepare_item", function ( $item, $product ) { $cost_updated_manually = isset( $item['cost_updated_manually'] ) ? $item['cost_updated_manually'] : false; if ( ! $cost_updated_manually ) { $item['item_cost'] = $product->get_price(''); } return $item; }, 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.
- 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, as it will be lost when the theme is updated.