create a custom webhooks
-
Hi,
i’m create a custom plugin to insert webhook data to woocommerce webhook tabel.
it transfer data perfectly but webhook process isn’t working. can i know the solution for that
this is my codepublic static function plugin_activated(){ if ( is_user_logged_in() ) { // Current user is logged in, // so let's get current user info $current_user = wp_get_current_user(); // User ID $user_id = $current_user->ID; } $array = current_datetime(); $my_current_time = $array->format('Y-m-d H:i:s'); $topic= array('customer.created','order.created'); $counting= count($topic); global $wpdb; for ($i=0; $i < $counting; $i++) { $table_name = $wpdb-> prefix.'wc_webhooks'; $wc_wbh_status = 'active'; $wc_wbh_name = $topic[$i]; $wc_wbh_user_id = $user_id; $wc_wbh_delivery_url = 'https://webhook.site/f0e621db-96cb-44a2-8d99-aff922c038f55'; $wc_wbh_secret='*******************'; $wc_wbh_topic = $topic[$i]; $wc_wbh_date_created = $my_current_time; $wc_wbh_date_created_gmt = $my_current_time; $wc_wbh_date_modified = $my_current_time; $wc_wbh_date_modified_gmt = $my_current_time; $wc_wbh_api_version = '3'; $wc_wbh_failure_count = '0'; $wc_wbh_pending_delivery = '0'; $wpdb -> insert($table_name, array( 'status' => $wc_wbh_status, 'name' => $wc_wbh_name, 'user_id' => $wc_wbh_user_id, 'delivery_url' => $wc_wbh_delivery_url, 'secret'=>$wc_wbh_secret, 'topic' => $wc_wbh_topic, 'date_created' => $wc_wbh_date_created, 'date_created_gmt' =>$wc_wbh_date_created_gmt, 'date_modified' =>$wc_wbh_date_modified, 'date_modified_gmt' =>$wc_wbh_date_modified_gmt, 'api_version' =>$wc_wbh_api_version, 'failure_count' =>$wc_wbh_failure_count, 'pending_delivery' =>$wc_wbh_pending_delivery ), ); } }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘create a custom webhooks’ is closed to new replies.