Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action('after_wcfmmp_product_multivendor_clone', function($new_product_id, $original_product) {
- $vendor_id = wcfm_get_vendor_id_by_post($original_product->get_id());
- if($vendor_id) {
- $vendor_user = new WP_User(absint($vendor_id));
- $store_email = wcfm_get_vendor_store_email_by_vendor($vendor_id);
- $new_vendor_id = wcfm_get_vendor_id_by_post($new_product_id);
- $new_store_name = wcfm_get_vendor_store_name($new_vendor_id);
- $store_url = wcfmmp_get_store_url( $new_vendor_id );
- if ( ! defined( 'DOING_WCFM_EMAIL' ) ) define( 'DOING_WCFM_EMAIL', true );
- $multivendor_message = sprintf( 'Product %s%s%s in your catalog is now sold by vendor %s%s%s', '<a href="'.get_permalink($original_product->get_id()).'">', $original_product->get_name(), '</a>', '<a href="'.$store_url.'">', $new_store_name, '</a>');
- $notificaton_mail_subject = "{site_name}: " . __( "Product is offered by other sellers", "wc-frontend-manager-ultimate" );
- $notification_mail_body = '<br/>' . __( 'Hi', 'wc-frontend-manager-ultimate' ) . ' {vendor_name}' .
- ',<br/><br/>' .
- '{multivendor_message}' .
- '<br/><br/>' .
- '<br /><br/>' . __( 'Thank You', 'wc-frontend-manager' ) .
- '<br/><br/>';
- $subject = str_replace( '{site_name}', get_bloginfo( 'name' ), $notificaton_mail_subject );
- $subject = apply_filters( 'wcfm_email_subject_wrapper', $subject );
- $message = str_replace( '{multivendor_message}', $multivendor_message, $notification_mail_body );
- $message = str_replace( '{vendor_name}', $vendor_user->first_name, $message );
- $message = apply_filters( 'wcfm_email_content_wrapper', $message, __( "Product Multivendor Notification", "wc-frontend-manager-ultimate" ) );
- wp_mail( $store_email, $subject, $message );
- }
- }, 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement