WordPress at Your Fingertips
function is not described

WC_AJAX::feature_product() public WC 1.0

Toggle Featured status of a product from admin.

{} It's a method of the class: WC_AJAX{}

No Hooks.

Return

null. Nothing.

Usage

$result = WC_AJAX::feature_product();

Code of WC_AJAX::feature_product() WC 5.9.0

public static function feature_product() {
	if ( current_user_can( 'edit_products' ) && check_admin_referer( 'woocommerce-feature-product' ) && isset( $_GET['product_id'] ) ) {
		$product = wc_get_product( absint( $_GET['product_id'] ) );

		if ( $product ) {
			$product->set_featured( ! $product->get_featured() );
			$product->save();
		}
	}

	wp_safe_redirect( wp_get_referer() ? remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'ids' ), wp_get_referer() ) : admin_url( 'edit.php?post_type=product' ) );
	exit;
}