Skip to content

Instantly share code, notes, and snippets.

@rashmimalpande
Last active June 19, 2022 14:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rashmimalpande/2631bc83164a5eb8b3f0dcc8b1dab9a0 to your computer and use it in GitHub Desktop.
Save rashmimalpande/2631bc83164a5eb8b3f0dcc8b1dab9a0 to your computer and use it in GitHub Desktop.
<?php $present = false; ?>
<?php foreach( $order->get_items() as $item ):
$_product = wc_get_product( $item['product_id'] );
// Add whatever product id you want below here
if ( $item['product_id'] == 643 ):
$present = true; ?>
<?php endif; endforeach; ?>
<?php if( $present ): ?>
<p class="woocommerce-notice woocommerce-notice--success woocommerce-thankyou-order-received"><?php echo apply_filters( 'woocommerce_thankyou_order_received_text', __( 'Thank you for buying this shirt', 'woocommerce' ), $order ); ?></p>
<?php else: ?>
<p class="woocommerce-notice woocommerce-notice--success woocommerce-thankyou-order-received"><?php echo apply_filters( 'woocommerce_thankyou_order_received_text', __( 'Thank you. Your order has been received.', 'woocommerce' ), $order ); ?></p>
<?php endif; ?>
@ZBytes0
Copy link

ZBytes0 commented Jun 19, 2022

Hi i need this for multipe products please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment