-
Notifications
You must be signed in to change notification settings - Fork 1
Description
User created code and would like for it to be reviewed and implemented into the WP HelpScout core application:
We sell insulated packaging and ice packs as an option for people who purchase heat-sensitive products from our woocommerce store. We used to sell them as an actual product, but found that it works better to sell it as a "fee" inside their woocommerce order. The problem is that we used to be able to see when a customer in helpscout had purchased the insulated packaging and ice packs in their woocommerce order by looking at the Woocommerce app in helpscount, but now that we reconfigured it as a fee instead of a product, the insulated packaging and ice packs no longer show up in helpscout, so we would have to open the actual order each time to see if someone purchased them.
I have this custom code snippet that I added to line 228, right after the foreach ( $items as $item_id => $item ) { ... } of HelpScout_Woo_App_Handler.php which allows me to see the fees in a customer's order in addition to products:
$fees = $order->get_fees();
foreach ( $fees as $fee_id => $fee ) {
$fee_details = '<div style="background: #fefefe;-webkit-border-radius: 3px;-moz-border-radius: 3px;border-radius: 3px;margin-bottom: 1em;padding: .5em .7em;">';
// generate fee string
$fee_details .= '<strong>' . wp_strip_all_tags( $fee['name'] ) . '</strong><br />';
$fee_details .= wc_price( $fee['line_total'], array( 'currency' => $order->get_order_currency() ) );
$fee_details .= '</div>';
$order_item_html[] = $fee_details;
}