PluginProbe ʕ •ᴥ•ʔ
AI ChatBot for eCommerce – WoowBot / 4.7.7
AI ChatBot for eCommerce – WoowBot v4.7.7
4.8.2 4.8.1 4.7.9 4.7.7 4.7.8 4.7.6 4.7.5 4.7.4 4.7.1 4.7.0 4.6.1 4.5.9 3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 3.5.7 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.6.9 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.8.8 3.8.9 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.3.2 4.3.3 4.3.4 4.3.5 4.3.6 4.3.7 4.3.8 4.3.9 4.4.0 4.4.1 4.4.2 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5.0 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 4.5.6 4.5.7 4.5.8 trunk 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7.0 1.8.0 1.9.0 2.0.0 2.1.0 2.2.0 2.3.0 2.4.0 2.5.0 2.6.0 2.7.0 2.8.0 2.9.0 3,2,7 3.0.0 3.1.0 3.1.1 3.1.2 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4
woowbot-woocommerce-chatbot / functions.php
woowbot-woocommerce-chatbot Last commit date
css 3 weeks ago fonts 3 weeks ago images 3 weeks ago includes 3 weeks ago js 3 weeks ago lang 3 weeks ago qc-support-promo-page 3 weeks ago class-plugin-deactivate-feedback.php 3 weeks ago class-qc-free-plugin-upgrade-notice.php 3 weeks ago functions.php 3 weeks ago qcld-recommendbot-plugin.php 3 weeks ago qcld-woowbot-info-page.php 3 weeks ago qcld-woowbot.php 3 weeks ago readme.txt 3 weeks ago woowbot-slick-button.png 3 weeks ago
functions.php
425 lines
1 <?php
2
3 /**
4 * @param $type
5 * Display recently viewed products
6 */
7 if (!defined('ABSPATH')) exit; // Exit if accessed directly
8
9
10 add_action('wp_footer', 'woo_chatbot_load_footer_html');
11 if(!function_exists('woo_chatbot_load_footer_html')){
12 function woo_chatbot_load_footer_html()
13 { ?>
14 <?php if (get_option('disable_woo_chatbot') != 1 && woo_chatbot_load_controlling()==true): ?>
15 <style>
16 <?php if(get_option('woo_chatbot_custom_css')!=""){echo esc_attr( get_option('woo_chatbot_custom_css') ); } ?>
17 <?php
18
19 if (get_option('qcld_woo_chatbot_change_bg') == 1) {
20 if (get_option('qcld_woo_chatbot_board_bg_path') != ""){
21
22 $qcld_woo_chatbot_board_bg_path = get_option('qcld_woo_chatbot_board_bg_path');
23
24 ?>
25
26 #woo-chatbot-ball-container:before {
27 background-image: url(<?php echo esc_url( $qcld_woo_chatbot_board_bg_path );?>) !important;
28 background-size: cover !important;
29 background-position: center center !important;
30 content: "";
31 position: absolute;
32 inset: 0;
33 filter: blur(6px);
34 z-index: 0;
35 }
36 #woo-chatbot-ball-container {
37 position: relative;
38 overflow: hidden;
39 }
40
41 <?php
42 }
43 }
44 ?>
45
46 </style>
47 <div id="woo-chatbot-icon-container">
48 <div id="woo-chatbot-ball-wrapper" style="display:none">
49
50 <div id="woo-chatbot-ball-container" style="display:none" class="woo-chatbot-ball-container">
51 <div class="woo-chatbot-admin">
52 <button type="button" id="woo-chatbot-expand-toggle" aria-label="<?php esc_attr_e('Expand chat window', 'woowbot-woocommerce-chatbot'); ?>"></button>
53 <h4><?php if(get_option('qlcd_woo_chatbot_conversations_with')!=''){echo esc_attr( get_option('qlcd_woo_chatbot_conversations_with') );}else{ esc_html_e('Conversations with', 'woowbot-woocommerce-chatbot'); } ?></h4>
54 <h3> <?php if(get_option('qlcd_woo_chatbot_agent')!=''){echo esc_attr( get_option('qlcd_woo_chatbot_agent') );} ?></h3>
55 <button type="button" id="woo-chatbot-header-close" aria-label="<?php esc_attr_e('Close chat window', 'woowbot-woocommerce-chatbot'); ?>">&times;</button>
56 </div>
57 <div class="woo-chatbot-ball-inner">
58 <div class="woo-chatbot-messages-wrapper">
59 <ul id="woo-chatbot-messages-container" class="woo-chatbot-messages-container">
60 </ul>
61 </div>
62 </div>
63 <div id="woo-chatbot-editor-container" class="woo-chatbot-editor-container">
64 <input id="woo-chatbot-editor" class="woo-chatbot-editor" required placeholder="<?php esc_html_e('Send a message.', 'woowbot-woocommerce-chatbot'); ?>">
65 <button type="button" id="woo-chatbot-send-message" class="woo-chatbot-button"><span class="dashicons dashicons-arrow-up-alt"></span></button>
66 </div>
67 </div>
68 <!--woo-chatbot-ball-container-->
69 <div id="woo-chatbot-ball" class="woo-chatbot-ball">
70 <?php
71
72 if(get_option('woo_chatbot_icon') != 'custom.png'){ ?>
73 <img src="<?php echo esc_url( QCLD_WOOCHATBOT_IMG_URL . '/' . get_option('woo_chatbot_icon') ); ?>"
74 alt="WooChatIcon">
75 <?php }else{
76 $custom_path = ((!empty(get_option('wp_chatbot_custom_icon_path'))) && !is_404(get_option('wp_chatbot_custom_icon_path'))) ? get_option('wp_chatbot_custom_icon_path') : QCLD_WOOCHATBOT_IMG_URL . '/icon-0.png';
77 ?>
78
79 <img width="60" height="60" src="<?php echo esc_attr( $custom_path); ?>"
80 alt="WooChatIcon">
81 <?php } ?>
82
83
84 </div>
85 <!--container-->
86 </div>
87 <!--woo-chatbot-ball-wrapper-->
88 </div>
89 <?php endif;
90
91 }
92 }
93
94 add_action('wp_ajax_qcld_woo_chatbot_keyword', 'qcld_woo_chatbot_keyword');
95 add_action('wp_ajax_nopriv_qcld_woo_chatbot_keyword', 'qcld_woo_chatbot_keyword');
96
97 if(!function_exists('qcld_woo_chatbot_keyword')){
98 function qcld_woo_chatbot_keyword()
99 {
100 $keyword = sanitize_text_field($_POST['keyword']);
101 $product_per_page = get_option('qlcd_woo_chatbot_ppp')!=''? get_option('qlcd_woo_chatbot_ppp') :10;
102 //Merging all query together.
103 $argu_params = array(
104 'post_type' => 'product',
105 'post_status' => 'publish',
106 'posts_per_page' => $product_per_page,
107 'order' => 'ASC',
108 's' => $keyword,
109 );
110 /******
111 *WP Query Operation to get products.*
112 *******/
113 $product_query = new WP_Query($argu_params);
114 $product_num = $product_query->post_count;
115 $html = '<div class="woo-chatbot-featured-products">';
116
117 $_pf = new WC_Product_Factory();
118 //repeating the products
119 if ($product_num > 0) {
120 //$html .= '<p>sdf sdfdsf : '.$asdfdf.'</p>';
121 $html .= '<ul class="woo-chatbot-products">';
122 while ($product_query->have_posts()) : $product_query->the_post();
123 $product = $_pf->get_product(get_the_ID());
124 //$qcld_thumb = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'shop_thumbnail' );
125 $image = get_the_post_thumbnail(get_the_ID(), 'shop_catalog');
126 if(empty($image)){
127 $image = woocommerce_placeholder_img( 'shop_catalog' );
128 }
129
130 $html .= '<li class="woo-chatbot-product">';
131 $html .= '<a target="_blank" href="' . get_permalink(get_the_ID()) . '" title="' . esc_attr($product->get_title()) . '">';
132 $html .= $image . '</a>
133 <div class="woo-chatbot-product-summary">
134 <div class="woo-chatbot-product-table">
135 <div class="woo-chatbot-product-table-cell">
136 <h3 class="woo-chatbot-product-title"><a target="_blank" href="' . get_permalink(get_the_ID()) . '" title="' . esc_attr($product->get_title()) . '">' . esc_attr($product->get_title()) . '</a></h3>
137 <div class="price">' . $product->get_price_html() . '</div>';
138
139 $html .= ' </div>
140 </div>
141 </div>
142 </li>';
143 endwhile;
144 wp_reset_postdata();
145 $html .= '</ul>';
146 }
147 $html .= '</div>';
148 $response = array('html' => $html, 'product_num' => $product_num);
149 wp_send_json($response);
150 }
151 }
152
153 add_action('wp_ajax_qcld_woo_chatbot_category', 'qcld_woo_chatbot_category');
154 add_action('wp_ajax_nopriv_qcld_woo_chatbot_category', 'qcld_woo_chatbot_category');
155 if(!function_exists('qcld_woo_chatbot_category')){
156 function qcld_woo_chatbot_category()
157 {
158 $terms = get_terms(array(
159 'taxonomy' => 'product_cat',
160 'hide_empty' => true,
161 ));
162 $html = "";
163 foreach ($terms as $term) {
164
165 $html .= '<span class="qcld-chatbot-product-category" type="button" data-category-slug="' . $term->slug . '" data-category-id="' . $term->term_id . '">' . $term->name . '</span>';
166 }
167 wp_send_json($html);
168 }
169 }
170 add_action('wp_ajax_qcld_woo_chatbot_category_products', 'qcld_woo_chatbot_category_products');
171 add_action('wp_ajax_nopriv_qcld_woo_chatbot_category_products', 'qcld_woo_chatbot_category_products');
172 function qcld_woo_chatbot_category_products()
173 {
174 $category_id = sanitize_text_field($_POST['category']);
175 $product_per_page=get_option('qlcd_woo_chatbot_ppp')!=''? get_option('qlcd_woo_chatbot_ppp') :10;
176 //Merging all query together.
177 $argu_params = array(
178 'post_type' => 'product',
179 'post_status' => 'publish',
180 'ignore_sticky_posts' => 1,
181 'posts_per_page' => $product_per_page,
182 'tax_query' => array(
183 array(
184 'taxonomy' => 'product_cat',
185 'field' => 'term_id',
186 'terms' => $category_id,
187 'operator' => 'IN'
188 )
189 )
190 );
191 /******* WP Query Operation to get products. ********/
192 $product_query = new WP_Query($argu_params);
193 $product_num = $product_query->post_count;
194
195 $_pf = new WC_Product_Factory();
196 //repeating the products
197 $html="";
198 if ($product_num > 0) {
199
200 $html .= '<div class="woo-chatbot-featured-products">';
201 //$html .= '<p>sdf sdfdsf : '.$asdfdf.'</p>';
202 $html .= '<ul class="woo-chatbot-products">';
203 while ($product_query->have_posts()) : $product_query->the_post();
204 $product = $_pf->get_product(get_the_ID());
205 //$qcld_thumb = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'shop_thumbnail' );
206 $html .= '<li class="woo-chatbot-product">';
207 $html .= '<a target="_blank" href="' . get_permalink(get_the_ID()) . '" title="' . esc_attr($product->post->post_title ? $product->post->post_title : get_the_ID()) . '">';
208 $image = get_the_post_thumbnail(get_the_ID(), 'shop_catalog');
209 if(empty($image)){
210 $image = woocommerce_placeholder_img( 'shop_catalog' );
211 }
212
213 $html .= $image . '</a>
214 <div class="woo-chatbot-product-summary">
215 <div class="woo-chatbot-product-table">
216 <div class="woo-chatbot-product-table-cell">
217 <h3 class="woo-chatbot-product-title"><a target="_blank" href="' . get_permalink(get_the_ID()) . '" title="' . esc_attr($product->post->post_title ? $product->post->post_title : get_the_ID()) . '">' . $product->post->post_title . '</a></h3>
218 <div class="price">' . $product->get_price_html() . '</div>';
219
220 // if ($product->is_type('simple')) {
221 // $html .= '<a target="_blank" href="' . get_site_url() . '?add-to-cart=' . get_the_ID() . '" title="' . esc_attr($product->post->post_title ? $product->post->post_title : get_the_ID()) . '" class="woo-chatbot-button woo-chatbot-button-cart add_to_cart_button ajax_add_to_cart" data-quantity="1" data-product_id="' . get_the_ID() . '" >Add to Cart</a>';
222 // } else {
223 // $html .= '<a target="_blank" href="' . get_permalink(get_the_ID()) . '" title="' . esc_attr($product->post->post_title ? $product->post->post_title : get_the_ID()) . '" class="woo-chatbot-button woo-chatbot-button-cart" >View Detail</a>';
224 // }
225 $html .= ' </div>
226 </div>
227 </div>
228 </li>';
229 endwhile;
230 wp_reset_postdata();
231 $html .= '</ul>';
232
233 $html .= '</div>';
234 }else{
235 $html.="";
236 }
237 $response = array('html' => $html, 'product_num' => $product_num);
238
239 wp_send_json($response);
240
241 }
242 //woo_chatbot load control handler.
243 if(!function_exists('woo_chatbot_load_controlling')){
244 function woo_chatbot_load_controlling(){
245 $woo_chatbot_load=true;
246 if(woo_chatbot_is_mobile()&& get_option('disable_woo_chatbot_on_mobile')==1){
247 $woo_chatbot_load=false;
248 }
249 if (get_option('wp_chatbot_show_pages') == 'off') {
250 $wp_chatbot_select_pages = unserialize(get_option('wp_chatbot_show_pages_list'));
251 if (is_page() && !empty($wp_chatbot_select_pages)) {
252
253 if (in_array(get_the_ID(), $wp_chatbot_select_pages) == true) {
254
255 $woo_chatbot_load = true;
256 } else {
257 $woo_chatbot_load = false;
258 }
259
260 }
261
262 if(function_exists('is_shop')){
263 if (is_shop() || is_cart() || is_checkout() || 'product' == get_post_type()) {
264 $woo_chatbot_load = false;
265 }
266 }
267
268 }
269 if (get_option('wp_chatbot_show_wpcommerce') == 'off') {
270
271 }
272 //load wpwbot shortcode template and prevent default wpwbot from footer.
273 if (is_page()) {
274 $page_id = get_the_ID();
275 $page = get_post($page_id);
276 if (has_shortcode($page->post_content, 'wpwbot')) {
277 $woo_chatbot_load = false;
278 }
279 }
280
281 $post_list = maybe_unserialize(get_option('wp_chatbot_exclude_post_list'));
282
283 if( is_array( $post_list ) && in_array(get_post_type(), $post_list)){
284 $woo_chatbot_load = false;
285 }
286 if (woo_chatbot_is_mobile() && get_option('disable_wp_chatbot_on_mobile') == 1) {
287 $woo_chatbot_load = false;
288 }
289
290 if (get_option('wp_chatbot_show_home_page') == 'off' && is_home()) {
291 $woo_chatbot_load = false;
292 }
293
294 if (get_option('wp_chatbot_show_posts') == 'off' && 'post' == get_post_type()) {
295 $woo_chatbot_load = false;
296 }
297
298 if(is_admin()){
299 $woo_chatbot_load = false;
300 }
301 return $woo_chatbot_load;
302 }
303 }
304 //checking Devices
305
306 if(!function_exists('woo_chatbot_is_mobile')){
307 function woo_chatbot_is_mobile(){
308 $useragent=$_SERVER['HTTP_USER_AGENT'];
309 if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i',substr($useragent,0,4))){
310 return true;
311 }else{
312 return false;
313 }
314 }
315 }
316 if(!function_exists('qc_fnc_get_ip_address')){
317 function qc_fnc_get_ip_address(){
318
319 if (!empty($_SERVER['HTTP_CLIENT_IP']))
320 {
321 $ip_address = $_SERVER['HTTP_CLIENT_IP'];
322 }
323 //whether ip is from proxy
324 elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
325 {
326 $ip_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
327 }
328 //whether ip is from remote address
329 else
330 {
331 $ip_address = $_SERVER['REMOTE_ADDR'];
332 }
333 return $ip_address;
334
335 }
336 }
337 add_action('wp_ajax_qcld_woo_chatbot_email', 'qcld_woo_chatbot_email');
338 add_action('wp_ajax_nopriv_qcld_woo_chatbot_email', 'qcld_woo_chatbot_email');
339 if(!function_exists('qcld_woo_chatbot_email')){
340 function qcld_woo_chatbot_email(){
341 $name = trim(sanitize_text_field($_POST['name']));
342 $email = sanitize_email($_POST['email']);
343 $message = sanitize_text_field($_POST['message']);
344 $page = $_POST['page'];
345 $subject = 'Support Request from WoowBot';
346
347 $user_agent = $_SERVER['HTTP_USER_AGENT'];
348 $ip_address = qc_fnc_get_ip_address();
349
350 //Extract Domain
351 $url = get_site_url();
352 $url = wp_parse_url($url);
353 $domain = $url['host'];
354
355 $admin_email = get_option('admin_email');
356 $toEmail = get_option('qlcd_wp_chatbot_admin_email') != '' ? get_option('qlcd_wp_chatbot_admin_email') : $admin_email;
357 $fromEmail = "wordpress@" . $domain;
358
359 if(get_option('qlcd_wp_chatbot_admin_from_email') && get_option('qlcd_wp_chatbot_admin_from_email')!=''){
360 $fromEmail = get_option('qlcd_wp_chatbot_admin_from_email');
361 }
362
363 $replyto = $fromEmail;
364
365 //Starting messaging and status.
366 $response['status'] = 'fail';
367 $response['message'] = 'Failed. Unable to send email.';
368 //build email body
369 $bodyContent = "";
370 $bodyContent .= '<p><strong>' . esc_html__('Support Request Details', 'woowbot-woocommerce-chatbot') . ':</strong></p><hr>';
371 $bodyContent .= '<p>' . esc_html__('Name', 'woowbot-woocommerce-chatbot') . ' : ' . esc_html($name) . '</p>';
372 $bodyContent .= '<p>' . esc_html__('Email', 'woowbot-woocommerce-chatbot') . ' : ' . esc_html($email) . '</p>';
373 $bodyContent .= '<p>' . esc_html__('Subject', 'woowbot-woocommerce-chatbot') . ' : ' . esc_html($subject) . '</p>';
374 $bodyContent .= '<p>' . esc_html__('Message', 'woowbot-woocommerce-chatbot') . ' : ' . esc_html($message) . '</p>';
375 $bodyContent .= '<p>' . esc_html__('Page', 'woowbot-woocommerce-chatbot') . ' : ' . ($page) . '</p>';
376 $bodyContent .= '<p>' . esc_html__('User Agent', 'woowbot-woocommerce-chatbot') . ' : ' . ($user_agent) . '</p>';
377 $bodyContent .= '<p>' . esc_html__('IP Address', 'woowbot-woocommerce-chatbot') . ' : ' . ($ip_address) . '</p>';
378 $bodyContent .= '<p>' . esc_html__('Mail Generated on', 'woowbot-woocommerce-chatbot') . ': ' . current_time('F j, Y, g:i a') . '</p>';
379 $to = $toEmail;
380 $body = $bodyContent;
381 $headers = array();
382 $headers[] = 'Content-Type: text/html; charset=UTF-8';
383 $headers[] = 'From: ' . esc_html($name) . ' <' . esc_html($fromEmail) . '>';
384 $headers[] = 'Reply-To: ' . esc_html($name) . ' <' . esc_html($email) . '>';
385 $result = wp_mail($to, $subject, $body, $headers);
386 $support_email_to_crm_contact = get_option('wpbot_support_mail_to_crm_contact');
387 if($support_email_to_crm_contact){
388 do_action( 'qcld_mailing_list_subscription_success', $name, $email );
389 }
390 if ($result) {
391 $response['status'] = 'success';
392 $response['message'] = 'Email has been sent successfully!';
393 }
394
395
396 echo wp_json_encode($response);
397
398 die();
399 }
400 }
401
402 // 1. Attach your custom function to a WooCommerce hook
403 if(get_option('enable_product_details_from_ai') == 1){
404 add_action( 'woocommerce_after_add_to_cart_button', 'qcld_woo_custom_product_details', 10 );
405 }
406 if(!function_exists('qcld_woo_custom_product_details')){
407 function qcld_woo_custom_product_details() {
408 echo '<div class="qcld_woo_product_details" data-product-id="' . get_the_ID() . '">' . esc_html('Click for Product Details') . '</div>';
409 }
410 }
411 if(!function_exists('qcld_wb_woowbot_func_str_replace')){
412
413 function qcld_wb_woowbot_func_str_replace($messages = array()){
414 $refined_mesgses = array();
415 foreach ($messages as $message) {
416 $refined_msg = str_replace('\\', '', $message);
417 array_push($refined_mesgses, $refined_msg);
418 }
419 return $refined_mesgses;
420 }
421 }
422
423
424
425