Skip to content

Database

Woo Sell Services creates two custom database tables for conversations and notifications. All other data is stored using standard WordPress and WooCommerce meta systems.

Stores all conversation messages between vendors and customers.

Column Type Description
id bigint(20) Auto-increment primary key
author_id bigint(20) User ID of the message sender
user_id bigint(20) User ID of the message recipient
order_id bigint(20) WooCommerce order ID
item_id bigint(20) WooCommerce order item ID
product_id bigint(20) WooCommerce product ID
message longtext Message content
msg_time datetime Message timestamp
attachment longtext Serialized attachment file paths
msg_read tinyint(1) Read status flag
read_status varchar(20) Read status string
created_at datetime Record creation time
updated_at datetime Last update time

Table name option: The full table name (with prefix) is stored in wp_options under the key woo_sell_message_table.

Stores in-app notifications for service order events.

Column Type Description
notification_id bigint(20) Auto-increment primary key
vendor_id bigint(20) Vendor user ID
user_id bigint(20) Customer user ID
order_id bigint(20) WooCommerce order ID
item_id bigint(20) WooCommerce order item ID
product_id bigint(20) WooCommerce product ID
vendor_notifi longtext Notification text for vendor
customer_notifi longtext Notification text for customer
vendor_read tinyint(1) Vendor read status
customer_read tinyint(1) Customer read status
created datetime Notification creation time
action varchar(100) Event type identifier

Table name option: The full table name is stored in wp_options under the key wss_service_notifications_table.

Meta Key Purpose
wbcom_wss_req_ques Serialized requirement field definitions
Meta Key Purpose
woo_sell_final_delivery Final delivery submission data
woo_sell_accept_delivery Delivery acceptance status
woo_sell_user_rating Star rating and review data
Option Key Purpose
wbwss_general_settings All general settings
wbwss_requirement_images_settings Milestone images for order flow
wbwss_live_notification_settings Notification message templates
wbwss_webhooks_settings Webhook URLs for events
woo_sell_message_table Messages table name
wss_service_notifications_table Notifications table name
edd_wbcom_wss_license_key EDD license key
edd_wbcom_wss_license_status License status

The messages table uses schema versioning (current version: 1.1) to handle upgrades. The version is checked on plugin activation, and dbDelta() is used to apply any schema changes.

Both tables are created in the Woo_Sell_Services_Activator::activate() method using dbDelta(). The activator runs on plugin activation and checks for schema updates.

The plugin uses $wpdb for direct queries against the custom tables. All queries use $wpdb->prepare() with parameterized placeholders for SQL injection prevention.

// Example: Fetch messages for an order
global $wpdb;
$table = get_option( 'woo_sell_message_table' );
$messages = $wpdb->get_results(
$wpdb->prepare(
"SELECT * FROM {$table} WHERE order_id = %d AND item_id = %d ORDER BY id ASC",
$order_id,
$item_id
)
);