Title: Function.php Dynamic Conversion Value Code
Last modified: March 14, 2022

---

# Function.php Dynamic Conversion Value Code

 *  Resolved [bbaros77](https://wordpress.org/support/users/bbaros77/)
 * (@bbaros77)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/function-php-dynamic-conversion-value-code/)
 * Hi,
 * I have to set dynamic conversion value for google ads,I want to do it without
   a plugin, I just need the code to get order total. For now I have set the same
   value for every order(conversion),I put this code in my function.php and it worksite
   is tracking conversions :
 *     ```
       add_action( 'woocommerce_thankyou', 'bbloomer_conversion_tracking_thank_you_page' );
   
       function bbloomer_conversion_tracking_thank_you_page() {
          ?>
       <!-- Event snippet for Kupnja dizajniraj majicu conversion page -->
          <script type="text/javascript">
          gtag('event', 'conversion', {
           'send_to': 'AW-975759864/-8vzCNae5aHGOIHfrdED',
           'value': 10.0,
           'currency': 'HRK',
           'transaction_id': ''
       });
          </script>
          <?php
       }
       ```
   
 * Some help would be much appreciated, should I use code like this,I found it on
   a woo-commerce site `
 * function my_custom_tracking( $order_id ) {
 * // Lets grab the order
    $order = wc_get_order( $order_id ); }`
 * and this goes in value <?php echo $order->get_total();?>
 * I could not get it to work.
 * Kind regards
 * Boris
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ffunction-php-dynamic-conversion-value-code%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Igor H](https://wordpress.org/support/users/ihereira/)
 * (@ihereira)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/function-php-dynamic-conversion-value-code/#post-15458921)
 * Hello,
 * Thanks for sending us your question. Our support for custom code in this forum
   is limited.
 * Since this is a development topic. I’m going to leave it open for a bit to see
   if anyone is able to chime in to help you out.
 * I can also recommend resources on developing for WooCommerce:
 * * [the WooCommerce Developer Resources Portal](https://developer.woocommerce.com/)
   *
   [WooCommerce Facebook group](https://www.facebook.com/groups/advanced.woocommerce/)*
   The `#developers` channel of the [WooCommerce Community Slack](https://woocommerce.com/community-slack/)
 * Thanks.
 *  [Margaret S. woo-hc](https://wordpress.org/support/users/margaretwporg/)
 * (@margaretwporg)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/function-php-dynamic-conversion-value-code/#post-15491198)
 * Seems we’ve not had additional inputs on this thread. Thus, we encourage you 
   to make use of the above resources.
 * I’ll go ahead and mark the thread as resolved but please feel free to create 
   a new thread if you have further questions.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Function.php Dynamic Conversion Value Code’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

 * 2 replies
 * 3 participants
 * Last reply from: [Margaret S. woo-hc](https://wordpress.org/support/users/margaretwporg/)
 * Last activity: [4 years, 2 months ago](https://wordpress.org/support/topic/function-php-dynamic-conversion-value-code/#post-15491198)
 * Status: resolved