Support » Plugin: WooCommerce Pixel Manager by woopt » Custom Profit Calculation

  • Resolved acehobojoe

    (@acehobojoe)


    Greetings! I used to use a custom calculation for sending the conversion value. For example (Order total * .2) it would make an on the fly estimate of our actual e-commerce profit and send it to the conversion event. Could I add this in somehow?

    I’m enjoying this plugin because it seems to fire more often than my default GTM integration. I think the serverside events are really helping post IOS14.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author alekv

    (@alekv)

    Hi @acehobojoe

    Could I add this in somehow?

    Yes, there’s a filter for this:

    https://docs.woopt.com/wgact/#/filters?id=conversion-value-filter

    Regards
    Aleks

    Thread Starter acehobojoe

    (@acehobojoe)

    Thank you,

    I’ve added it as a snippet.

    Plugin Author alekv

    (@alekv)

    Hi @acehobojoe

    I renamed the filter from wgact_conversion_value_filter to wooptpm_conversion_value_filter.

    Your filter with the older filter name will keep working. But I recommend switching to the new one.

    Thread Starter acehobojoe

    (@acehobojoe)

    After adding this snippet, I get a syntax error related to the “public” function. Is that correct?

    add_filter( 'wooptpm_conversion_value_filter', array( $this, 'filter_conversion_value' ), 10, 2 );
    
    public function filter_conversion_value( $order_total, $order ) {
    
        /** 
      This is 90% of the order value as an estimate
        **/
    
        return $order_total * 0.9;
    }
    Plugin Author alekv

    (@alekv)

    Oh, my bad. I should have quickly tested the example…

    Following the correct code:

    add_filter('wooptpm_conversion_value_filter', 'filter_conversion_value', 10, 2);
    
    function filter_conversion_value($order_total, $order)
    {
    
        /**
         * This is 90% of the order value as an estimate
         **/
    
        return $order_total * 0.9;
    }
    • This reply was modified 4 months, 1 week ago by alekv.
    Thread Starter acehobojoe

    (@acehobojoe)

    Thanks Alek, it works now.

    I meant to try leaving it on, but I couldn’t get to it til recently.

    Plugin Author alekv

    (@alekv)

    Great. Thanks for the feedback!

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.