• Resolved swerlz

    (@swerlz)


    Hi,

    I need to add a script to a processing email with some details from the order. Can I get some help with this please.

    Atm I am trying to add this after the hook “do_action( ‘woocommerce_email_header’, $email_heading, $email ); ?>”

    in “customer-processing-order.php”

    global $order;
    $theSku = '';
    
    foreach ( $order->get_items() as $item_id => $item ) {
              $sku = $item->get_sku();
              
              $theSku .= $sku . ',';
    }
    
    $tSku = substr($theSku, 0,-1);
    
    echo '<script type="application/json+trustpilot">
       { 
          "recipientName": "'. $order->get_billing_first_name().'", 
          "recipientEmail": "'. $order->get_billing_email().'", 
          "referenceId": "'. $order->get_id().'", 
          "productSkus": ["'.$tSku.'"]
       }
    </script>';

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Mirko P.

    (@rainfallnixfig)

    Hi there,

    This is a fairly complex 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 the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook Community group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Thanks.

    Mirko P.

    (@rainfallnixfig)

    Hi there,

    Since there have not been responses here, I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

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

The topic ‘Add Script to Email Template’ is closed to new replies.