title: How to add tracking code in woocommerce's "thankyou" page
body: <p>I'm using <code>Woocommerce</code>, it's up to date.</p>
  
  <p>I've been looking for answers about my issue. I found quite a lot of posts about it but they don't seem to help me figure out the solution.</p>
  
  <p>Found <a href="https://businessbloomer.com/woocommerce-add-conversion-tracking-code-thank-page/" rel="nofollow noreferrer">this website</a> that describes how to hook the conversion code. </p>
  
  <p>I tried quite a lot of snippets but the code doesn't fire.</p>
  
  <p>Basically, I've got an <code>iframe</code> code that I need to add to my conversion page.
  This page is created from the template <code>&lt;b&gt;thankyou.php&lt;/b&gt;</code></p>
  
  <p>I added some code through a hook to <b>function.php</b> but the iframe doesn't show up in the conversion page.</p>
  
  <p>In order to test the code, I've been checking the network tab in "inspect element". It doesn't fire, I cannot even find the code in the page.</p>
  
  <p>Here's the <code>iframe</code> code: </p>
  
  <pre><code>[iframe src="https://lb.affilae.com/?key=59f3463ce8faceb82f8b4571-
  59f345fedca96b441b37b6ce&amp;id={UNIQUE_ID}&amp;amount={AMOUNT}&amp;payment=
  {PAYMENT}&amp;cv={CUSTOM_VAR}" frameborder="0" width="1" height="1"]
  </code></pre>
  
  <p>It is a wordpress shortcode, the only way for it to show up on the page.</p>
  
  <p>Here's the hook I've been using:</p>
  
  <pre><code>add_action( 'woocommerce_thankyou', 'bbloomer_add_content_thankyou' );
  
  function bbloomer_add_content_thankyou() {
  echo 'my iframe conversion code';
  }
  </code></pre>
  
  <p>Do you have any idea how to fix this?
  I can provide more info if needed.</p>
  
  <p>Edit:</p>
  
  <p>I found a solution!</p>
  
  <p>The main issue came from the fact that I didn't specified the unique ID and the amount.</p>
  
  <p>Here's the code that solved it all:</p>
  
  <pre><code>add_action( 'woocommerce_thankyou', 'my_custom_tracking' );
  function my_custom_tracking( $order_id ) {   
  $order = new WC_Order( $order_id );   
  $total = $order-&gt;get_subtotal();   
  $id = str_replace('#', '', $order-&gt;get_order_number());   
  echo '&lt;iframe src="https://lb.affilae.com/?[replace with the right code]&amp;id=' . $id . '&amp;amount=' . $total . 
  '&amp;payment=online&amp;cv={CUSTOM_VAR}" frameborder="0" width="1" height="1"&gt;
  &lt;/iframe&gt;'; 
  }
  </code></pre>
  
  <p>I pasted this code at the top of the function.php file (after