title: How to correctly call a function in one plugin, from another plugin, which relies on WooCommerce variables
body: <p>I am using WooCommerce with two plugins: </p>
  
  <ul>
  <li>Yith Gift Card and </li>
  <li>WooCommerce Pos. </li>
  </ul>
  
  <p>Yith Gift Card plugin, allows you to sell Gift Card tokens for your store. 
  When someone purchases a gift card the WooCommerce order confirmation has the Gift Code printed on it. </p>
  
  <p>The WooCommerce POS plugin, allows you to print a receipt from a printer. The problem is the coupon code does not display on this printed receipt. </p>
  
  <p><strong><em>How the coupon code is added to the WooCommerce e-mail</em></strong></p>
  
  <p>The Yith Gift Card Plugin adds an action via a WooCommerce e-mail hook, here is the code, excerpted from the Yith Plugin php: </p>
  
  <pre><code>class YITH_WooCommerce_Gift_Cards {
      ...
  
              add_action( 'woocommerce_order_item_meta_start', array(
                  $this,
                  'show_gift_card_code',
              ), 10, 3 );
  
          }
  
  
          public function show_gift_card_code( $order_item_id, $item, $order ) {
  
              $code = wc_get_order_item_meta( $order_item_id, YWGC_META_GIFT_CARD_NUMBER );
  
              if ( ! empty( $code ) ) {
  
                  printf( '&lt;br&gt;' . __( 'Gift card code: %s', 'yith-woocommerce-gift-cards' ), $code );
              }
          }
  </code></pre>
  
  <p>This results in the coupon code being displayed on the WooCommerce order e-mail. </p>
  
  <p>I want the same coupon code to appear on the printed POS receipt. </p>
  
  <p><strong><em>How the printed POS receipt is generated</em></strong></p>
  
  <p>I've found the file responsible for printing the printed POS receipt. 
  It is here: <a href="https://github.com/kilbot/WooCommerce-POS/blob/master/includes/views/print/receipt-html.php" rel="nofollow noreferrer">https://github.com/kilbot/WooCommerce-POS/blob/master/includes/views/print/receipt-html.php</a></p>
  
  <p>How can I call the show_gift_card_code function from within receipt-html.php? So that it successfully displays the Gift Card Coupon code?</p>
  
  <pre><code>&lt;table class="order-items"&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th class="product"&gt;&lt;?php /* translators: woocommerce */ _e( 'Product', 'woocommerce' ); ?&gt;&lt;/th&gt;
        &lt;th class="qty"&gt;&lt;?php _ex( 'Qty', 'Abbreviation of Quantity', 'woocommerce-pos' ); ?&gt;&lt;/th&gt;
        &lt;th class="price"&gt;&lt;?php /* translators: woocommerce */ _e( 'Price', 'woocommerce' ); ?&gt;&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    {{#each line_items}}
      &lt;tr&gt;
        &lt;td class="product"&gt;
          {{name}}
          [*I WOULD LIKE THE COUPON CODE DISPLAYED HERE*]
          {{#with meta}}
          &lt;dl class="meta"&gt;
            {{#each []}}
            &lt;dt&gt;{{label}}:&lt;/dt&gt;
            &lt;dd&gt;{{value}}&lt;/dd&gt;
            {{/each}}
          &lt;/dl&gt;
          {{/with}}
        &lt;/td&gt;
  </code></pre>