Created
August 23, 2021 08:27
-
-
Save santanup789/410057c0af51dccb5e478700f4ffba30 to your computer and use it in GitHub Desktop.
Add Custom link or text in view order page under user's my account page in WooCommerce for a particular page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Providing the Gold pack download link on view order page under my account page. | |
add_action( 'woocommerce_view_order', 'before_woocommerce_order_details', 5 ); | |
function before_woocommerce_order_details($order_id){ | |
$order = wc_get_order( $order_id ); | |
$items = $order->get_items(); | |
foreach ( $items as $item_id => $item ) { | |
$product_id = $item->get_variation_id() ? $item->get_variation_id() : $item->get_product_id(); | |
if ( $product_id === 8936 ) { | |
if( $order->get_status() == 'processing' || $order->get_status() == 'completed' ) { | |
echo '<h3 style="background: #70C0AD;font-size: 20px;padding: 20px;margin-bottom: 30px; color: #fff;">In this order, you have purchased <a href="h#" target="_bkank" style="Color: #000; font-weight: bold;">Kidney Solution Gold Pack</a>. Please download the package from <a href="#" target="_bkank" style="Color: #000; font-weight: bold;">HERE</a>.</h3>'; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment