1

I am using this code to display woocommerce custom field on frontend:

// DISPLAY Source Product URL ---------------------------------
           echo '<div class="woo_echo">';
            echo '<div class="woo_echo_inner">';
            echo "<span style='font-weight:600;'>". __( 'Source Product URL:</span> <span> ', 'woocommerce' )  . $_p_source_url ."</span>";
            $_p_source_url = get_post_meta($product_id, "_p_source_url", true);
           echo '</div>';
           echo '</div>';

It works very well but I would like

. $_p_source_url .

to be clickable link. Is it possible to wrap it with a tag?

In this example source url is original url of scraped product not woocommerce product url.

Lestra
  • 39
  • 6

1 Answers1

1

You need something like this :

echo "<a href='$YOUR_LINK_PRODUCT_URL'>product</a>";

EDIT

echo '<div class="woo_echo">';
echo '<div class="woo_echo_inner">';
echo "<span style='font-weight:600;'>". __( 'Source Product URL:</span> <span> ', 'woocommerce' )  . $_p_source_url ."</span>";
$_p_source_url = get_post_meta($product_id, "_p_source_url", true);
echo "<a href='$_p_source_url'>product</a>";
echo '</div>';
echo '</div>';
Skizo-ozᴉʞS ツ
  • 19,464
  • 18
  • 81
  • 148