Forked from alamgircsebd/dokan_thank_you_order_received_text_modified
Created
December 9, 2021 23:10
-
-
Save mmarj/17aa5b03218d627910cf2f6f14d23265 to your computer and use it in GitHub Desktop.
Thank you message modified to vendor info on order received page
This file contains 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
// How Use => Add this scripts on your theme functions.php file | |
// Output => https://prnt.sc/y4ljek | |
/** | |
* Thank you message modified to vendor info on order received page | |
* | |
* @param string $thank_you_title | |
* @param obj $order | |
* | |
* @return string | |
*/ | |
function dokan_thank_you_order_received_text_modified( $thank_you_title, $order ) { | |
if ( ! class_exists( 'WeDevs_Dokan' ) ) { | |
return $thank_you_title; | |
} | |
$sellers = dokan_get_seller_id_by_order( $order->get_id() ); | |
if ( $order->get_meta( 'has_sub_order' ) ) { | |
echo __( '<strong>Vendor: </strong>', 'woocommerce' ); | |
$incree = 0; | |
foreach ( $sellers as $seller ) { | |
$seller_info = dokan_get_store_info( $seller ); | |
if ( 0 === $incree ) { | |
echo $seller_info[ 'store_name' ]; | |
} else { | |
echo ', ' . $seller_info[ 'store_name' ]; | |
} | |
$incree++; | |
} | |
} else { | |
$seller_info = dokan_get_store_info( $sellers ); | |
echo __( '<strong>Vendor: </strong>', 'woocommerce' ) . $seller_info[ 'store_name' ]; | |
} | |
return __( '<br><br>Hi ', 'woocommerce' ) . $order->get_billing_first_name() . __( ', thank you so much for your order!', 'woocommerce' ); | |
} | |
add_filter( 'woocommerce_thankyou_order_received_text', 'dokan_thank_you_order_received_text_modified', 35, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment