• 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 code

    public 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
    		),
    		
    		);
    		}
        }
    • This topic was modified 3 years, 10 months ago by bcworkz.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘webhook’ is closed to new replies.