Skip to content

Instantly share code, notes, and snippets.

@Musilda
Created January 14, 2022 06:06
Show Gist options
  • Save Musilda/5977340e24ec3650e1e7bb0404c640e4 to your computer and use it in GitHub Desktop.
Save Musilda/5977340e24ec3650e1e7bb0404c640e4 to your computer and use it in GitHub Desktop.
<?php
add_shortcode( 'tatum_minted_address', 'tatum_get_minted_address' );
function tatum_get_minted_address() {
$html = '';
if ( !empty( $_GET['order'] ) ) {
$order_id = (int)$_GET['order'];
$order = wc_get_order( $order_id ) {
if ( is_object( $order ) ) {
global $wpdb;
foreach ($order->get_items() as $order_item) {
$product_id = $order_item->get_product_id();
if ($product_id) {
$minted_nfts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "prepared_nft INNER JOIN " . $wpdb->prefix . "lazy_nft ON " . $wpdb->prefix . "lazy_nft.prepared_nft_id = " . $wpdb->prefix . "prepared_nft.id WHERE product_id = $product_id AND order_id = $order_id");
foreach ($minted_nfts as $minted_nft) {
if ($minted_nft->transaction_id != "") {
$link = BlockchainLink::txLink($minted_nft->transaction_id, $minted_nft->chain);
$html .= "$link<br>";
}
}
}
}
}
}
}
return $html;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment