• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wc_print_notice函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wc_print_notice函数的典型用法代码示例。如果您正苦于以下问题:PHP wc_print_notice函数的具体用法?PHP wc_print_notice怎么用?PHP wc_print_notice使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wc_print_notice函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: sv_wc_memberships_member_discount_product_notice

/**
 * Check if a product has a member discount
 * Example: Display a member discount notice
 */
function sv_wc_memberships_member_discount_product_notice()
{
    // bail if Memberships isn't active
    if (!function_exists('wc_memberships')) {
        return;
    }
    // Set a discount end date
    $discount_ends = date_i18n(wc_date_format(), strtotime('2015-12-31'));
    // Add our top notice if the member has a discount
    if (wc_memberships_user_has_member_discount()) {
        wc_print_notice(sprintf('Act fast! Your member discount ends on %s.', $discount_ends), 'notice');
    }
}
开发者ID:skyverge,项目名称:wc-plugins-snippets,代码行数:17,代码来源:product-member-discount-notice.php


示例2: wc_minimum_order_amount

function wc_minimum_order_amount()
{
    global $woocommerce;
    $postcode = get_user_meta(get_current_user_id(), 'shipping_postcode', true);
    if (strstr(' 90024 90027 90028 90029 90034 90036 90038 90039 90046 90048 90064 90066 90067 90068 90069 90095 90230 90291 90401 90402 90403 90404 90405 91505 91506 91602 91604 91607 91608 90010 90012 90019 90020 90025 90232 91601 91606 90073 90031 90090 90005 90004 90026 90035 90056 90211 90212 ', $postcode)) {
        $minimum = 60;
    } else {
        if (strstr(' 90045 90049 90016 90292 91423 90008 90018 90045 90049 90210 90245 90272 90293 90077 90094 91403 91436 90079 90210 90007 90015 90017 90057 90071 90089 90266 90013 90014 ', $postcode)) {
            $minimum = 100;
        } else {
            $minimum = false;
        }
    }
    if ($minimum == false) {
        wc_print_notice(sprintf('We are unable to service your area at this time. Please give us a call at (323) 450-7708 to discuss arrangements for your delivery.', wc_price($minimum), wc_price(WC()->cart->subtotal)), 'error');
        echo "<script>\n\t\t\t\tjQuery(document).ready(function(\$) {\n\t\t\t\t\t\$('.checkout-button').addClass('disabled');\n\t\t\t\t\t\$('.checkout-button').click(function(e) { e.preventDefault(); });\n\t\t\t\t});\n\t\t\t</script>";
    } elseif (WC()->cart->subtotal < $minimum) {
        if (is_cart()) {
            wc_print_notice(sprintf('Based on your zip code ' . $postcode . ', you must have an order with a minimum of %s to checkout. Your current order total is %s.', wc_price($minimum), wc_price(WC()->cart->subtotal)), 'error');
            echo "\n\t\t\t\t<script>\n\t\t\t\t\tjQuery(document).ready(function(\$) {\n\t\t\t\t\t\t\$('.checkout-button').addClass('disabled');\n\t\t\t\t\t\t\$('.checkout-button').click(function(e) { e.preventDefault(); });\n\t\t\t\t\t});\n\t\t\t\t</script>";
        } else {
            wc_add_notice(sprintf('Based on your zip code ' . $postcode . ', you must have an order with a minimum of %s to checkout. Your current order total is %s.', wc_price($minimum), wc_price(WC()->cart->subtotal)), 'error');
        }
    }
}
开发者ID:keyshames,项目名称:tcm2016,代码行数:25,代码来源:checkout.php


示例3: sv_wc_memberships_members_only_product_notice

/**
 * Check if product purchasing is retricted
 * Example: Add a restricted product notice
 * Display a top notice to non-members for members-only products
 */
function sv_wc_memberships_members_only_product_notice()
{
    // bail if Memberships isn't active
    if (!function_exists('wc_memberships')) {
        return;
    }
    $user_id = get_current_user_id();
    // Bail if the user is already a silver or gold member
    if (wc_memberships_is_user_active_member($user_id, 'silver') || wc_memberships_is_user_active_member($user_id, 'gold')) {
        return;
    }
    // Add our top notice if purchasing is restricted
    if (wc_memberships_is_product_purchasing_restricted()) {
        wc_print_notice('This is a preview! Only silver or gold members can purchase this product.', 'notice');
    }
}
开发者ID:skyverge,项目名称:wc-plugins-snippets,代码行数:21,代码来源:product-restricted-notice.php


示例4: wc_print_notice

 /**
  * Print a single notice immediately
  *
  * WC notice funtions are not available in the admin
  *
  * @since 3.0.2
  * @param string $message The text to display in the notice.
  * @param string $notice_type The singular name of the notice type - either error, success or notice. [optional]
  */
 public static function wc_print_notice($message, $notice_type = 'success')
 {
     if (function_exists('wc_print_notice')) {
         wc_print_notice($message, $notice_type);
     }
 }
开发者ID:javolero,项目名称:dabba,代码行数:15,代码来源:class-sv-wc-helper.php


示例5: wc_print_notices

<?php

/**
 * Lost password confirmation text.
 *
 * This template can be overridden by copying it to yourtheme/woocommerce/myaccount/lost-password-confirmation.php.
 *
 * HOWEVER, on occasion WooCommerce will need to update template files and you
 * (the theme developer) will need to copy the new files to your theme to
 * maintain compatibility. We try to do this as little as possible, but it does
 * happen. When this occurs the version of the template file will be bumped and
 * the readme will list any important changes.
 *
 * @see     https://docs.woothemes.com/document/template-structure/
 * @author  WooThemes
 * @package WooCommerce/Templates
 * @version 2.6.0
 */
if (!defined('ABSPATH')) {
    exit;
}
wc_print_notices();
wc_print_notice(__('Password reset email has been sent.', 'woocommerce'));
?>

<p><?php 
echo apply_filters('woocommerce_lost_password_message', __('A password reset email has been sent to the email address on file for your account, but may take several minutes to show up in your inbox. Please wait at least 10 minutes before attempting another reset.', 'woocommerce'));
?>
</p>
开发者ID:ksan5835,项目名称:maadithottam,代码行数:29,代码来源:lost-password-confirmation.php


示例6: order_minimum_amount

 /**
  * order_minimum_amount.
  */
 public function order_minimum_amount()
 {
     $minimum = get_option('wcj_order_minimum_amount');
     if (WC()->cart->total < $minimum) {
         if (is_cart()) {
             if ('yes' === get_option('wcj_order_minimum_amount_cart_notice_enabled')) {
                 wc_print_notice(sprintf(apply_filters('wcj_get_option_filter', 'You must have an order with a minimum of %s to place your order, your current order total is %s.', get_option('wcj_order_minimum_amount_cart_notice_message')), woocommerce_price($minimum), woocommerce_price(WC()->cart->total)), 'notice');
             }
         } else {
             wc_add_notice(sprintf(apply_filters('wcj_get_option_filter', 'You must have an order with a minimum of %s to place your order, your current order total is %s.', get_option('wcj_order_minimum_amount_error_message')), woocommerce_price($minimum), woocommerce_price(WC()->cart->total)), 'error');
         }
     }
 }
开发者ID:yarwalker,项目名称:ecobyt,代码行数:16,代码来源:class-wcj-orders.php


示例7: maybe_render_social_buttons

 /**
  * Maybe render social buttons in two places:
  *
  * 1) a separate notice on the checkout page with "login in with..." buttons
  *
  * 2) a notice on the thank you page with the "link your account" buttons
  *
  * @since 1.1.0
  * @param string $template_name template being loaded by WC
  */
 public function maybe_render_social_buttons($template_name)
 {
     // separate notice at checkout
     if ('checkout/form-login.php' === $template_name && $this->is_displayed_on('checkout_notice') && !is_user_logged_in()) {
         wc_print_notice($this->get_login_buttons_html(WC()->cart->get_checkout_url()), 'notice');
     } elseif ('checkout/thankyou.php' === $template_name && 'yes' === get_option('wc_social_login_display_link_account_thank_you') && is_user_logged_in()) {
         // notice on thank you page
         $message = '<p>' . esc_html__('Save time next time you checkout by linking your account to your favorite social network. No need to remember another username and password.', 'woocommerce-social-login') . '</p>';
         wc_print_notice($message . $this->get_link_account_buttons_html(), 'notice');
     }
 }
开发者ID:pcuervo,项目名称:dabba,代码行数:21,代码来源:class-wc-social-login-frontend.php


示例8: printWCNotice

    /**
     * Print WP Notices.
     *
     * @param $notices
     *
     * @since 1.0.7
     */
    public function printWCNotice ( $notices ) {

        if ( is_array( $notices ) && array_key_exists( 'message' , $notices ) && array_key_exists( 'type' , $notices ) ) {
            // Pre Version 1.2.0 of wwpp where it sends back single dimension array of notice

            // Print notice why a wholesale user is not qualified for a wholesale price
            // Only print on cart page ( Have some side effects when printed on checkout page )
            wc_print_notice( $notices[ 'message' ] , $notices[ 'type' ] );

        } elseif ( is_array( $notices ) ) {
            // Version 1.2.0 of wwpp where it sends back multiple notice via multi dimensional arrays

            foreach ( $notices as $notice ) {

                if ( array_key_exists( 'message' , $notice ) && array_key_exists( 'type' , $notice ) )
                    wc_print_notice( $notice[ 'message' ] , $notice[ 'type' ] );

            }

        }

    }
开发者ID:helloworld-digital,项目名称:katemorgan,代码行数:29,代码来源:class-wwp-wholesale-prices.php


示例9: beforeWCWidget

 /**
  * Add notice to WC Widget if the user (wholesale user) fails to avail the wholesale price requirements.
  * Only applies to wholesale users.
  *
  * @param $userWholesaleRole
  *
  * @since 1.0.0
  */
 public function beforeWCWidget($userWholesaleRole)
 {
     // We have to explicitly call this.
     // You see, WC Widget uses get_sub_total() to for its total field displayed on the widget.
     // This function gets only synced once calculate_totals() is triggered.
     // calculate_totals() is only triggered on the cart and checkout page.
     // So if we don't trigger calculate_totals() manually, there will be a scenario where the cart widget total isn't
     // synced with the cart page total. The user will have to go to the cart page, which triggers calculate_totals,
     // which synced get_sub_total(), for the user to have the cart widget synched the price.
     WC()->cart->calculate_totals();
     $applyWholesalePrice = $this->checkIfApplyWholesalePrice(WC()->cart, $userWholesaleRole);
     // Only display notice if user is a wholesale user.
     if ($applyWholesalePrice !== true && !empty($userWholesaleRole)) {
         if (is_array($applyWholesalePrice) && array_key_exists('message', $applyWholesalePrice) && array_key_exists('type', $applyWholesalePrice)) {
             // Print notice why a wholesale user is not qualified for a wholesale price
             wc_print_notice($applyWholesalePrice['message'], $applyWholesalePrice['type']);
         }
     }
 }
开发者ID:sawan34,项目名称:tanzi,代码行数:27,代码来源:class-wwp-wholesale-prices.php


示例10: ajax_multiproduct_add_to_cart

 function ajax_multiproduct_add_to_cart()
 {
     global $post, $woocommerce, $product;
     foreach ($_POST as $item) {
         $success_message = isset($this->options['add_to_cart_success_message']) ? $this->options['add_to_cart_success_message'] : '{wcbo_pn} successfully added to cart.';
         $failure_message = isset($this->options['add_to_cart_failure_message']) ? $this->options['add_to_cart_failure_message'] : 'There was an error adding {wcbo_pn} to your cart.';
         /* Set arrays and variables */
         $prod_id = $item['id'];
         $var_id = '';
         $quantity = $item['quantity'];
         $attributes = $item['atts'];
         /* Get Product by id*/
         $product = wc_get_product($prod_id);
         /* Set attribute array for this cart item and modify it to fit  */
         $att_query = array();
         foreach ($attributes as $name => $value) {
             $new_att_name = 'attribute_' . $name;
             $value = str_replace(" ", "-", $value);
             $att_query[$new_att_name] = strtolower($value);
         }
         /* If has children get variations and check the array against the data passed before */
         if ($product->has_child()) {
             $available_variations = $product->get_available_variations();
             $count = count($available_variations);
             /* if only one variation, use only one id */
             if ($count == '1') {
                 foreach ($available_variations as $avar) {
                     $var_id = $avar['variation_id'];
                     $attributes = $att_query;
                     $result = $woocommerce->cart->add_to_cart($prod_id, $quantity, $var_id, $attributes, null);
                     if (!empty($result)) {
                         $message = $success_message;
                         $message = html_entity_decode(str_replace('{wcbo_pn}', $product->get_formatted_name(), $message));
                         wc_print_notice($message, $notice_type = 'success');
                     } else {
                         $message = $failure_message;
                         $message = html_entity_decode(str_replace('{wcbo_pn}', $product->get_formatted_name(), $message));
                         wc_print_notice($message, $notice_type = 'error');
                     }
                 }
                 /* if more than one variation, do this fancy pants logic */
             } elseif ($count > '1') {
                 $var_id = '';
                 $count_difference = '999';
                 foreach ($available_variations as $avar) {
                     $attributes = $avar['attributes'];
                     $att_count = count($attributes);
                     /* check for exact match. If exact, add to cart and exit */
                     if ($att_query == $attributes) {
                         $var_id = $avar['variation_id'];
                         break;
                     } else {
                         $difference = array_diff($att_query, $attributes);
                         $cdif = count($difference);
                         if ($cdif < $count_difference) {
                             $count_difference = $cdif;
                             $var_id = $avar['variation_id'];
                             $check_dif = $difference;
                         }
                     }
                 }
                 $attributes = $att_query;
                 $result = $woocommerce->cart->add_to_cart($prod_id, $quantity, $var_id, $attributes, null);
                 if (!empty($result)) {
                     $message = $success_message;
                     $message = html_entity_decode(str_replace('{wcbo_pn}', $product->get_formatted_name(), $message));
                     wc_print_notice($message, $notice_type = 'success');
                 } else {
                     $message = $failure_message;
                     $message = html_entity_decode(str_replace('{wcbo_pn}', $product->get_formatted_name(), $message));
                     wc_print_notice($message, $notice_type = 'error');
                 }
             }
             /* If no children, just add to cart */
         } else {
             $result = $woocommerce->cart->add_to_cart($prod_id, $quantity);
             if (!empty($result)) {
                 $message = $success_message;
                 $message = html_entity_decode(str_replace('{wcbo_pn}', $product->get_formatted_name(), $message));
                 wc_print_notice($message, $notice_type = 'success');
             } else {
                 $message = $failure_message;
                 $message = html_entity_decode(str_replace('{wcbo_pn}', $product->get_formatted_name(), $message));
                 wc_print_notice($message, $notice_type = 'error');
             }
         }
     }
     exit;
 }
开发者ID:hslatman,项目名称:woocommerce-bulk-order-form,代码行数:89,代码来源:variation_search_template.php


示例11: acf_add_options_page

<?php

// add notice to checkout page
if (function_exists('acf_add_options_page')) {
    acf_add_options_page(array('page_title' => 'StayDry Theme Settings', 'menu_title' => 'Theme Settings', 'menu_slug' => 'theme-general-settings', 'capability' => 'edit_posts', 'redirect' => false));
    acf_add_options_sub_page(array('page_title' => 'Checkout Settings', 'menu_title' => 'Checkout', 'parent_slug' => 'theme-general-settings'));
    acf_add_options_sub_page(array('page_title' => 'Homepage Settings', 'menu_title' => 'Homepage', 'parent_slug' => 'theme-general-settings'));
}
if (function_exists('acf_add_local_field_group')) {
    acf_add_local_field_group(array('key' => 'group_573aa44477932', 'title' => 'Checkout Notice', 'fields' => array(array('key' => 'field_573aa66b7515a', 'label' => 'Notice Header', 'name' => 'checkout_notice_header', 'type' => 'text', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'default_value' => '', 'placeholder' => '', 'prepend' => '', 'append' => '', 'maxlength' => '', 'readonly' => 0, 'disabled' => 0), array('key' => 'field_573aa6a07515b', 'label' => 'Notice Body', 'name' => 'checkout_notice_body', 'type' => 'wysiwyg', 'instructions' => '', 'required' => 1, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'default_value' => '', 'tabs' => 'all', 'toolbar' => 'basic', 'media_upload' => 0)), 'location' => array(array(array('param' => 'options_page', 'operator' => '==', 'value' => 'acf-options-checkout'))), 'menu_order' => 0, 'position' => 'normal', 'style' => 'default', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => '', 'active' => 1, 'description' => ''));
}
add_action('woocommerce_before_checkout_form', function () {
    $header = get_field('checkout_notice_header', 'option');
    $body = get_field('checkout_notice_body', 'option');
    wc_print_notice(sprintf('<h4>%s</h4>%s', $header, $body), 'notice');
}, 10);
开发者ID:cimocimocimo,项目名称:staydrysystems.com,代码行数:16,代码来源:custom-fields.php


示例12: maybe_render_checkout_member_login_notice

 /**
  * Maybe render checkout member login notice
  *
  * @since 1.0.0
  * @param string $template_name template being loaded by WC
  */
 public function maybe_render_checkout_member_login_notice($template_name)
 {
     // separate notice at checkout
     if (!is_user_logged_in() && 'checkout/form-login.php' === $template_name) {
         $display_in = get_option('wc_memberships_display_member_login_notice');
         if (in_array($display_in, array('checkout', 'both')) && $this->cart_has_items_with_member_discounts()) {
             $message = $this->get_member_login_message();
             wc_print_notice(sprintf($message, '', ''), 'notice');
         }
     }
 }
开发者ID:eugene-gromky-co,项目名称:mindfulnesssummit,代码行数:17,代码来源:class-wc-memberships-frontend.php


示例13: do_action

        do_action('woocommerce_thankyou_' . $order->payment_method, $order->id);
        ?>
						<?php 
        do_action('woocommerce_thankyou', $order->id);
        ?>

					</div>
				</div>
				<div class="one column row">
					<div class="column">
						<p>Bling Software Corporation, Azuero Business Center, Suite 541, Avenida Perez Chitre, Panama, 00395, Republica de Panama</p>
					</div>
				</div>
			</div>
		</section>

	<?php 
    }
    ?>

<?php 
} else {
    ?>

	<?php 
    $message = '<p>' . apply_filters('woocommerce_thankyou_order_received_text', __('Thank you. Your order has been received.', 'woocommerce'), null) . '</p>';
    wc_print_notice($message, 'success');
    ?>

<?php 
}
开发者ID:lauralapadat,项目名称:testgit,代码行数:31,代码来源:thankyou.php


示例14: order_minimum_amount

 /**
  * order_minimum_amount.
  *
  * @version 2.5.5
  */
 public function order_minimum_amount()
 {
     $minimum = $this->get_order_minimum_amount_with_user_roles();
     if (0 == $minimum) {
         return;
     }
     $cart_total = $this->get_cart_total_for_minimal_order_amount();
     if ($cart_total < $minimum) {
         if (is_cart()) {
             if ('yes' === get_option('wcj_order_minimum_amount_cart_notice_enabled')) {
                 wc_print_notice(sprintf(apply_filters('booster_get_option', 'You must have an order with a minimum of %s to place your order, your current order total is %s.', get_option('wcj_order_minimum_amount_cart_notice_message')), woocommerce_price($minimum), woocommerce_price($cart_total)), 'notice');
             }
         } else {
             wc_add_notice(sprintf(apply_filters('booster_get_option', 'You must have an order with a minimum of %s to place your order, your current order total is %s.', get_option('wcj_order_minimum_amount_error_message')), woocommerce_price($minimum), woocommerce_price($cart_total)), 'error');
         }
     }
 }
开发者ID:algoritmika,项目名称:woocommerce-jetpack,代码行数:22,代码来源:class-wcj-order-min-amount.php


示例15: test_wc_print_error_notice

 /**
  * Test wc_print_notice() w/ error type.
  *
  * @since 2.2
  */
 public function test_wc_print_error_notice()
 {
     // specific type
     $this->expectOutputString('<ul class="woocommerce-error"><li>Error!</li></ul>');
     wc_print_notice('Error!', 'error');
 }
开发者ID:bitoncoin,项目名称:woocommerce,代码行数:11,代码来源:notice-functions.php


示例16: wc_minimum_order_amount

function wc_minimum_order_amount()
{
    global $woocommerce;
    $postcode = $woocommerce->customer->get_shipping_postcode();
    if (strstr(' 90024 90027 90028 90029 90034 90036 90038 90039 90045 90046 90048 90049 90064 90066 90067 90068 90069 90095 90230 90291 90401 90402 90403 90404 90405 91505 91506 91602 91604 91607 91608 ', $postcode)) {
        $minimum = 60;
    } else {
        if (strstr(' 90005 ', $postcode)) {
            $minimum = 70;
        } else {
            if (strstr(' 90004 ', $postcode)) {
                $minimum = 75;
            } else {
                if (strstr(' 90016 90026 90035 90056 90211 90212 90292 91423 ', $postcode)) {
                    $minimum = 80;
                } else {
                    if (strstr(' 90008 90018 90045 90049 90210 90245 90272 90293 90293 ', $postcode)) {
                        $minimum = 100;
                    } else {
                        if (strstr(' 90007 90015 90017 90057 90071 90089 90266 ', $postcode)) {
                            $minimum = 120;
                        } else {
                            if (strstr(' 90013 90014 ', $postcode)) {
                                $minimum = 150;
                            } else {
                                $minimum = 60;
                            }
                        }
                    }
                }
            }
        }
    }
    if (WC()->cart->subtotal < $minimum) {
        if (is_cart()) {
            wc_print_notice(sprintf('Based on your zip code ' . $postcode . ', you must have an order with a minimum of %s to place your order. Your current order total is %s.', wc_price($minimum), wc_price(WC()->cart->subtotal)), 'error');
            echo "\n\t\t\t\t<script>\n\t\t\t\t\tjQuery(document).ready(function(\$) {\n\t\t\t\t\t\t\$('.checkout-button').addClass('disabled');\n\t\t\t\t\t\t\$('.checkout-button').click(function(e) { e.preventDefault(); });\n\t\t\t\t\t});\n\t\t\t\t</script>";
        } else {
            wc_add_notice(sprintf('Based on your zip code ' . $postcode . ', you must have an order with a minimum of %s to place your order. Your current order total is %s.', wc_price($minimum), wc_price(WC()->cart->subtotal)), 'error');
        }
    }
}
开发者ID:keyshames,项目名称:tcm2016,代码行数:42,代码来源:functions.20160124.php


示例17: apply_filters

/**
 * Checkout coupon form
 *
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     2.2
 */
if (!defined('ABSPATH')) {
    exit;
    // Exit if accessed directly
}
if (!WC()->cart->coupons_enabled()) {
    return;
}
$info_message = apply_filters('woocommerce_checkout_coupon_message', __('Have a coupon?', 'woocommerce') . ' <a href="#" class="showcoupon">' . __('Click here to enter your code', 'woocommerce') . '</a>');
wc_print_notice($info_message, 'notice');
?>

<form class="ui form checkout_coupon" method="post" style="display:none">
	<div class="ui action input coupon">
		<input type="text" name="coupon_code" class="input-text" placeholder="<?php 
_e('Coupon code', 'woocommerce');
?>
" id="coupon_code" value="" />
		<button type="submit" class="ui button" name="apply_coupon" value="<?php 
_e('Apply Coupon', 'woocommerce');
?>
"><?php 
_e('Apply Coupon', 'woocommerce');
?>
</button>
开发者ID:lauralapadat,项目名称:testgit,代码行数:31,代码来源:form-coupon.php


示例18: ajax_registration_error

 /**
  * Return login error in JSON
  *
  * Intercepts WooCommerce login error in case of an AJAX
  * login request and sends back results in JSON, skipping
  * the loading of the rest of the page
  *
  * @param string $errors
  *
  * @since 1.0.0
  */
 public function ajax_registration_error($errors)
 {
     if (isset($_POST['_wc_product_reviews_pro_ajax_register']) && wc_notice_count('error') > 0) {
         $all_notices = WC()->session->get('wc_notices', array());
         $error_notices = $all_notices['error'];
         // Safety net against unwanted error notices not related to registration
         $errors_start = array_search('_wc_product_reviews_pro_ajax_registration_errors_start', $error_notices);
         if (false !== $errors_start) {
             $error_notices = array_slice($error_notices, $errors_start + 1);
         }
         // Format the error(s) for output
         ob_start();
         foreach ($error_notices as $notice) {
             wc_print_notice($notice, 'error');
         }
         $message = ob_get_clean();
         // Send JSON error
         wp_send_json_error(array('message' => $message));
     }
 }
开发者ID:brian3t,项目名称:orchidmate,代码行数:31,代码来源:class-wc-product-reviews-pro-ajax.php



注:本文中的wc_print_notice函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wc_print_notices函数代码示例发布时间:2022-05-23
下一篇:
PHP wc_prices_include_tax函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap