Home Forums WoodMart support forum Wishlist: WordPress database error Unknown column ‘on_sale’ Reply To: Wishlist: WordPress database error Unknown column ‘on_sale’

#570731

Artem Temos
Keymaster

Try to add the following code to the functions.php file in your child theme. Open your website home page and then remove the code .It should fix the error.

add_action(
	'init',
	function() {
		global $wpdb;

		require_once( ABSPATH . 'wp-admin/install-helper.php' );

		maybe_add_column(
			$wpdb->woodmart_products_table,
			'on_sale',
			"ALTER TABLE $wpdb->woodmart_products_table
			ADD COLUMN on_sale boolean NOT NULL
			AFTER date_added"
		);
	}
);