• Resolved dabeecher

    (@dabeecher)


    Hello, is it possible to modify the Total revenue field in the new customer history meta box in the edit order screen? I can’t seem to find a hook/filter that will do it.

    I want to update the value to remove refunded items as its not a true representation currently

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Rajesh K. (woo-hc)

    (@rajeshml)

    Hello @dabeecher,

    For reference, this particular forum is meant for general support with the core functionality of WooCommerce itself. For development and custom coding questions, it’s best to ask for insight related to those on either the WooCommerce Advanced Facebook group or the WooCommerce Community Slack. Many of our developers hang out there and will be able to offer insights into your question. You can also seek help from the following:

    I wish I could help more, but hopefully, this gets you going in the right direction to get some further insight/information.

    Evolved

    (@evolved)

    Good question @dabeecher we’re looking for editing the Customer History Panel this too. If we find something will let you know.

    Plugin Support Zubair Zahid (woo-hc)

    (@doublezed2)

    Hello Evolved

    Thank you for your message here.

    I understand your message is intended for @dabeecher.
    I wanted to appreciate your step in helping out a Woo community member.

    Have a great day!

    Evolved

    (@evolved)

    Hi Debeecher,

    We modified the Customer History metabox to show things like

    Customer age: 4.7 years (since 11 Nov 2019)
    Total orders: 32
    Total revenue: $12,820.23
    Average order value: $400.63
    Average order daterange: Every 54 days

    we used the filter “wc_get_template” to redirect the customer history template to a self-defined template file in a plugin we may release soon:

    add_filter( 'wc_get_template',
    function ($template, $template_name, $args) {
    
        if ($template_name === 'order/customer-history.php') {
            return plugin_dir_path( __FILE__ ) . 'woocommerce/templates/order/customer-history.php';
        }
    
        return $template;
    },
    10,
    3);

    In customer-history.php you can place things like Total Revenue, and modify $total_spend as you like:
    e.g.

    <h4>
        <?php
        esc_html_e( 'Total revenue', 'woocommerce' );
        echo wp_kses_post(
            wc_help_tip(
                __( "This is the Customer Lifetime Value, or the total amount you have earned from this customer's orders.", 'woocommerce' )
            )
        );
        ?>
    </h4>
    <span class="order-attribution-total-spend">
        <?php echo wp_kses_post( wc_price( $total_spend ) ); ?>
    </span>
    Thread Starter dabeecher

    (@dabeecher)

    Thanks very much… that was the only way I could find was to modify the template which I really didn’t want to do…

    Surprised there is no hook to update current values etc.

    Looks like I’ll go down the same route

    Evolved

    (@evolved)

    Yep, at least its possible I guess.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Customer History’ is closed to new replies.