WC_AJAX::feature_product()
Toggle Featured status of a product from admin.
Метод класса: WC_AJAX{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$result = WC_AJAX::feature_product();
Код WC_AJAX::feature_product() WC AJAX::feature product WC 9.2.3
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; }