'yes', 'default_phone' => '', 'mode' => 'order_first', 'order_status' => 'pending', 'guest_allowed' => 'yes', 'countries' => array(), 'hide_checkout_button' => 'no', 'product_button_label' => __( 'Order via Chat', 'ordercourier' ), 'cart_button_label' => __( 'Send Order via Chat', 'ordercourier' ), 'checkout_button_label' => __( 'Confirm via Chat', 'ordercourier' ), 'button_color' => '#25D366', 'button_text_color' => '#ffffff', 'show_product_button' => 'yes', 'show_shop_button' => 'no', 'show_cart_button' => 'yes', 'show_minicart_button' => 'yes', 'widget_enabled' => 'no', 'widget_position' => 'bottom-right', 'widget_greeting' => __( 'Need help? Chat with us!', 'ordercourier' ), 'rate_limit' => 5, 'rate_limit_window' => 600, 'data_retention_days' => 90, 'uninstall_cleanup' => 'no', ); $settings = get_option( 'ordercourier_settings', array() ); return wp_parse_args( $settings, $defaults ); } /** * Get a specific setting. * * @param string $key Setting key. * @param mixed $default_value Default value. * @return mixed */ public static function get( $key, $default_value = null ) { $settings = self::get_all(); return isset( $settings[ $key ] ) ? $settings[ $key ] : $default_value; } /** * Update settings. * * @param array $new_settings New settings. * @return bool */ public static function update( $new_settings ) { $settings = self::get_all(); $settings = array_merge( $settings, $new_settings ); return update_option( 'ordercourier_settings', $settings ); } /** * Check if enabled. * * @return bool */ public static function is_enabled() { return 'yes' === self::get( 'enabled', 'yes' ); } /** * Get templates. * * @return array */ public static function get_templates() { return get_option( 'ordercourier_templates', array() ); } /** * Update templates. * * @param array $templates New templates. * @return bool */ public static function update_templates( $templates ) { return update_option( 'ordercourier_templates', $templates ); } }