本文整理汇总了PHP中wc_has_notice函数的典型用法代码示例。如果您正苦于以下问题:PHP wc_has_notice函数的具体用法?PHP wc_has_notice怎么用?PHP wc_has_notice使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wc_has_notice函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: test_wc_has_notice
/**
* Test wc_has_notice().
*
* @since 2.2
*/
function test_wc_has_notice()
{
// negative
wc_add_notice('Bogus Notice', 'success');
$this->assertFalse(wc_has_notice('Legit Notice'));
// positive
wc_add_notice('One True Notice', 'notice');
$this->assertTrue(wc_has_notice('One True Notice', 'notice'));
}
开发者ID:bitoncoin,项目名称:woocommerce,代码行数:14,代码来源:notice-functions.php
示例2: get_errors
/**
* Get any errors from querystring.
*/
public function get_errors()
{
if (!empty($_GET['wc_error']) && ($error = sanitize_text_field($_GET['wc_error'])) && !wc_has_notice($error, 'error')) {
wc_add_notice($error, 'error');
}
}
开发者ID:seriusokhatsky,项目名称:woocommerce,代码行数:9,代码来源:class-wc-query.php
示例3: maybe_cancel_checkout_with_paypal
public function maybe_cancel_checkout_with_paypal()
{
if (is_cart() && !empty($_GET['wc-gateway-ppec-clear-session'])) {
$this->maybe_clear_session_data();
if (!wc_has_notice(__('You have cancelled Checkout with PayPal. Please try to process your order again.', 'woocommerce-gateway-paypal-express-checkout'), 'notice')) {
wc_add_notice(__('You have cancelled Checkout with PayPal. Please try to process your order again.', 'woocommerce-gateway-paypal-express-checkout'), 'notice');
}
}
}
开发者ID:ksan5835,项目名称:maadithottam,代码行数:9,代码来源:class-wc-gateway-ppec-checkout-handler.php
示例4: load_shipping_methods
/**
* Loads all shipping methods which are hooked in. If a $package is passed some methods may add themselves conditionally.
*
* Loads all shipping methods which are hooked in.
* If a $package is passed some methods may add themselves conditionally and zones will be used.
*
* @param array $package
* @return array
*/
public function load_shipping_methods($package = array())
{
if (!empty($package)) {
$status_options = get_option('woocommerce_status_options', array());
$shipping_zone = WC_Shipping_Zones::get_zone_matching_package($package);
$this->shipping_methods = $shipping_zone->get_shipping_methods(true);
// Debug output
if (!empty($status_options['shipping_debug_mode']) && !defined('WOOCOMMERCE_CHECKOUT') && !wc_has_notice('Customer matched zone "' . $shipping_zone->get_zone_name() . '"')) {
wc_add_notice('Customer matched zone "' . $shipping_zone->get_zone_name() . '"');
}
} else {
$this->shipping_methods = array();
}
// For the settings in the backend, and for non-shipping zone methods, we still need to load any registered classes here.
foreach ($this->get_shipping_method_class_names() as $method_id => $method_class) {
$this->register_shipping_method($method_class);
}
// Methods can register themselves manually through this hook if necessary.
do_action('woocommerce_load_shipping_methods', $package);
// Return loaded methods
return $this->get_shipping_methods();
}
开发者ID:TakenCdosG,项目名称:chefs,代码行数:31,代码来源:class-wc-shipping.php
示例5: cart_items_loaded_from_session
/**
* Does some housekeeping. Fires after the items have been passed through the get items from session filter. Because
* that filter is not good for removing cart items, we need to work around that by doing it later, in the cart
* loaded from session action.
*
* This checks cart items whether underlying subscriptions / renewal orders they depend exist. If not, they are
* removed from the cart.
*
* @param $cart WC_Cart the one we got from session
*/
public function cart_items_loaded_from_session($cart)
{
$removed_count_subscription = $removed_count_order = 0;
foreach ($cart->cart_contents as $key => $item) {
if (isset($item[$this->cart_item_key]['subscription_id']) && !wcs_is_subscription($item[$this->cart_item_key]['subscription_id'])) {
$cart->remove_cart_item($key);
$removed_count_subscription++;
continue;
}
if (isset($item[$this->cart_item_key]['renewal_order_id']) && !'shop_order' == get_post_type($item[$this->cart_item_key]['renewal_order_id'])) {
$cart->remove_cart_item($key);
$removed_count_order++;
continue;
}
}
if ($removed_count_subscription) {
$error_message = esc_html(_n('We couldn\'t find the original subscription for an item in your cart. The item was removed.', 'We couldn\'t find the original subscriptions for items in your cart. The items were removed.', $removed_count_subscription, 'woocommerce-subscriptions'));
if (!wc_has_notice($error_message, 'notice')) {
wc_add_notice($error_message, 'notice');
}
}
if ($removed_count_order) {
$error_message = esc_html(_n('We couldn\'t find the original renewal order for an item in your cart. The item was removed.', 'We couldn\'t find the original renewal orders for items in your cart. The items were removed.', $removed_count_order, 'woocommerce-subscriptions'));
if (!wc_has_notice($error_message, 'notice')) {
wc_add_notice($error_message, 'notice');
}
}
}
开发者ID:slavic18,项目名称:cats,代码行数:38,代码来源:class-wcs-cart-renewal.php
示例6: load_shipping_methods
/**
* Load shipping methods
*/
public function load_shipping_methods($package)
{
// Register the main class
woocommerce_register_shipping_method('WC_Shipping_Table_Rate');
if (!$package) {
return;
}
// Get zone for package
$zone = woocommerce_get_shipping_zone($package);
if (TABLE_RATE_SHIPPING_DEBUG) {
$notice_text = 'Customer matched shipping zone <strong>' . $zone->zone_name . '</strong> (#' . $zone->zone_id . ')';
if (!wc_has_notice($notice_text, 'notice')) {
wc_add_notice($notice_text, 'notice');
}
}
if ($zone->exists()) {
// Register zone methods
$zone->register_shipping_methods();
}
}
开发者ID:arobbins,项目名称:spellestate,代码行数:23,代码来源:woocommerce-table-rate-shipping.php
注:本文中的wc_has_notice函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论