تابع ووکامرسی wc_print_notices نمایش هشدار و خطا ها و حذف آن
تابع ووکامرسی wc_print_notices – نمایش هشدار و خطا های ذخیره شده در session کاربر و سپس حذف آن
Syntax – سینتکس
wc_print_notices();
Usage – نحوه استفاده
if ( !function_exists( 'wc_print_notices' ) ) { require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-notice-functions.php'; } // NOTICE! Understand what this does before running. $result = wc_print_notices();
Defined – محل تعریف
/includes/wc-notice-functions.php
function wc_print_notices() { if ( ! did_action( 'woocommerce_init' ) ) { wc_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before woocommerce_init.', woocommerce ), '2.3' ); return; } $all_notices = WC()->session->get( 'wc_notices', array() ); $notice_types = apply_filters( 'woocommerce_notice_types', array( error, 'success', 'notice' ) ); foreach ( $notice_types as $notice_type ) { if ( wc_notice_count( $notice_type ) > 0 ) { wc_get_template( "notices/{$notice_type}.php", array( 'messages' => array_filter( $all_notices[ $notice_type ] ), ) ); } } wc_clear_notices(); }
versions – نسخه ها
از نسخه : 2.1
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر