当前位置: 首页>>代码示例>>PHP>>正文


PHP wc_clear_notices函数代码示例

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


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

示例1: wpuw_redirect_to_checkout

function wpuw_redirect_to_checkout()
{
    if (isset($_POST['wpuw_add_product'])) {
        $product_id = (int) apply_filters('woocommerce_add_to_cart_product_id', $_POST['add-to-cart']);
        if (has_term('credit', 'product_cat', $product_id)) {
            global $woocommerce;
            wc_clear_notices();
            return $woocommerce->cart->get_checkout_url();
        }
    }
}
开发者ID:justingreerbbi,项目名称:user-waller-credit-system,代码行数:11,代码来源:filters.php

示例2: shortcode_handler

 /**
  * Frontend Shortcode Handler
  *
  * @param array $atts array of attributes
  * @param string $content text within enclosing form of shortcode element
  * @param string $shortcodename the shortcode found, when == callback name
  * @return string $output returns the modified html string
  */
 function shortcode_handler($atts, $content = "", $shortcodename = "", $meta = "")
 {
     $output = "";
     $meta['el_class'];
     global $woocommerce, $product;
     if (!is_object($woocommerce) || !is_object($woocommerce->query) || empty($product)) {
         return;
     }
     // $product = wc_get_product();
     $output .= "<div class='av-woo-purchase-button " . $meta['el_class'] . "'>";
     ob_start();
     wc_clear_notices();
     woocommerce_template_single_add_to_cart();
     $output .= ob_get_clean();
     $output .= "</div>";
     return $output;
 }
开发者ID:erikdukker,项目名称:medisom,代码行数:25,代码来源:product_snippet_button.php

示例3: maybe_apply_subscriber_discount

 public function maybe_apply_subscriber_discount()
 {
     $user_id = get_current_user_id();
     if ($user_id) {
         $discount_coupon_code = MP_Integration::$discount_coupon_code;
         if (!empty($discount_coupon_code)) {
             $sub_id = get_user_meta($user_id, 'mp_subscription_id', true);
             if ($sub_id) {
                 if (!WC()->cart->has_discount($discount_coupon_code)) {
                     WC()->cart->add_discount($discount_coupon_code);
                 }
                 wc_clear_notices();
             } else {
                 WC()->cart->remove_coupon($discount_coupon_code);
             }
         }
     }
 }
开发者ID:hwillson,项目名称:woocommerce-moreplease,代码行数:18,代码来源:class-mp-discount.php

示例4: shortcode_handler

 /**
  * Frontend Shortcode Handler
  *
  * @param array $atts array of attributes
  * @param string $content text within enclosing form of shortcode element
  * @param string $shortcodename the shortcode found, when == callback name
  * @return string $output returns the modified html string
  */
 function shortcode_handler($atts, $content = "", $shortcodename = "", $meta = "")
 {
     $output = "";
     $meta['el_class'];
     global $woocommerce, $product;
     if (!is_object($woocommerce) || !is_object($woocommerce->query) || empty($product)) {
         return;
     }
     $temp = $product->post->post_content;
     $product->post->post_content = "";
     // $product = wc_get_product();
     $output .= "<div class='av-woo-product-review av-woo-product-tabs product " . $meta['el_class'] . "'>";
     ob_start();
     wc_clear_notices();
     woocommerce_output_product_data_tabs();
     // comments_template('reviews');
     $output .= ob_get_clean();
     $output .= "</div>";
     $product->post->post_content = $temp;
     return $output;
 }
开发者ID:erikdukker,项目名称:medisom,代码行数:29,代码来源:product_snippet_tabs.php

示例5: wc_print_notices

/**
 * Prints messages and errors which are stored in the session, then clears them.
 *
 * @since 2.1
 */
function wc_print_notices()
{
    $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' => $all_notices[$notice_type]));
        }
    }
    wc_clear_notices();
}
开发者ID:chhavinav,项目名称:fr.ilovejuice,代码行数:16,代码来源:wc-notice-functions.php

示例6: cart_view

 public function cart_view()
 {
     if ($this->isSilenced()) {
         $this->getApplicationContext()->getComponent('\\FS\\Components\\Options')->log($this->notifications);
     } else {
         \wc_clear_notices();
         foreach ($this->notifications as $type => $notifications) {
             if (!$notifications) {
                 continue;
             }
             $html = implode('<br/>', $notifications);
             \wc_add_notice($html, $type);
         }
     }
     if ($this->prev) {
         return $this->restore();
     }
     $this->scope();
     return $this->cleanup();
 }
开发者ID:flagshipcompany,项目名称:flagship-for-woocommerce,代码行数:20,代码来源:Notifier.php

示例7: paypal_express_checkout


//.........这里部分代码省略.........
                 $this->add_log(__('Error Severity Code: ', 'paypal-for-woocommerce') . $ErrorSeverityCode);
                 // Notice admin if has any issue from PayPal
                 $message = '';
                 if ($this->error_email_notify) {
                     $admin_email = get_option("admin_email");
                     $message .= __("SetExpressCheckout API call failed.", "paypal-for-woocommerce") . "\n\n";
                     $message .= __('Error Code: ', 'paypal-for-woocommerce') . $ErrorCode . "\n";
                     $message .= __('Error Severity Code: ', 'paypal-for-woocommerce') . $ErrorSeverityCode . "\n";
                     $message .= __('Short Error Message: ', 'paypal-for-woocommerce') . $ErrorShortMsg . "\n";
                     $message .= __('Detailed Error Message: ', 'paypal-for-woocommerce') . $ErrorLongMsg . "\n";
                     $error_email_notify_mes = apply_filters('angelleye_ec_error_email_notify_message', $message, $ErrorCode, $ErrorSeverityCode, $ErrorShortMsg, $ErrorLongMsg);
                     $subject = "PayPal Express Checkout Error Notification";
                     $error_email_notify_subject = apply_filters('angelleye_ec_error_email_notify_subject', $subject);
                     wp_mail($admin_email, $error_email_notify_subject, $error_email_notify_mes);
                 }
                 // Generate error message based on Error Display Type setting
                 if ($this->error_display_type == 'detailed') {
                     $sec_error_notice = $ErrorCode . ' - ' . $ErrorLongMsg;
                     $error_display_type_message = sprintf(__($sec_error_notice, 'paypal-for-woocommerce'));
                 } else {
                     $error_display_type_message = sprintf(__('There was a problem paying with PayPal.  Please try another method.', 'paypal-for-woocommerce'));
                 }
                 $error_display_type_message = apply_filters('angelleye_ec_display_type_message', $error_display_type_message, $ErrorCode, $ErrorLongMsg);
                 wc_add_notice($error_display_type_message, 'error');
                 if (!is_ajax()) {
                     wp_redirect(get_permalink(wc_get_page_id('cart')));
                     exit;
                 } else {
                     return;
                 }
             }
         }
     } elseif (isset($_GET['pp_action']) && $_GET['pp_action'] == 'revieworder') {
         wc_clear_notices();
         // The customer has logged into PayPal and approved order.
         // Retrieve the shipping details and present the order for completion.
         if (!defined('WOOCOMMERCE_CHECKOUT')) {
             define('WOOCOMMERCE_CHECKOUT', true);
         }
         $this->add_log('Start Review Order');
         if (isset($_GET['token'])) {
             $token = $_GET['token'];
             $this->set_session('TOKEN', $token);
         }
         if (isset($_GET['PayerID'])) {
             $payerID = $_GET['PayerID'];
             $this->set_session('PayerID', $payerID);
         }
         $this->add_log("...Token:" . $this->get_session('TOKEN'));
         $this->add_log("...PayerID: " . $this->get_session('PayerID'));
         $result = $this->CallGetShippingDetails($this->get_session('TOKEN'));
         if (!empty($result)) {
             $this->set_session('RESULT', serialize($result));
             if (isset($result['SHIPTOCOUNTRYCODE'])) {
                 /**
                  * Check if shiptocountry is in the allowed countries list
                  */
                 if (!array_key_exists($result['SHIPTOCOUNTRYCODE'], WC()->countries->get_allowed_countries())) {
                     wc_add_notice(sprintf(__('We do not sell in your country, please try again with another address.', 'paypal-for-woocommerce')), 'error');
                     wp_redirect(get_permalink(wc_get_page_id('cart')));
                     exit;
                 }
                 WC()->customer->set_shipping_country($result['SHIPTOCOUNTRYCODE']);
             }
             if (isset($result['SHIPTONAME'])) {
                 WC()->customer->shiptoname = $result['SHIPTONAME'];
开发者ID:ujam-dev,项目名称:paypal-woocommerce,代码行数:67,代码来源:wc-gateway-paypal-express-angelleye.php

示例8: save_pending

 /**
  *
  *
  * @param unknown $user_id
  */
 public function save_pending($user_id)
 {
     if (isset($_POST['apply_for_vendor'])) {
         wc_clear_notices();
         if (user_can($user_id, 'manage_options')) {
             wc_add_notice(apply_filters('wcvendors_application_denied_msg', __('Application denied. You are an administrator.', 'wcvendors')), 'error');
         } else {
             wc_add_notice(apply_filters('wcvendors_application_submitted_msg', __('Your application has been submitted.', 'wcvendors')), 'notice');
             $manual = WC_Vendors::$pv_options->get_option('manual_vendor_registration');
             $role = apply_filters('wcvendors_pending_role', $manual ? 'pending_vendor' : 'vendor');
             $wp_user_object = new WP_User($user_id);
             $wp_user_object->set_role($role);
             do_action('wcvendors_application_submited', $user_id);
             add_filter('woocommerce_registration_redirect', array($this, 'redirect_to_vendor_dash'));
         }
     }
 }
开发者ID:stodorovic,项目名称:wcvendors,代码行数:22,代码来源:class-vendor-signup.php

示例9: apply_membership_benifits

function apply_membership_benifits()
{
    global $woocommerce;
    $level = get_user_info('loyalty_status');
    $total = floatval(preg_replace('#[^\\d.]#', '', $woocommerce->cart->get_cart_total()));
    if ($level == 'Green' || $woocommerce->cart->has_discount($level)) {
        return;
    } elseif ($total < 3660) {
        /* echo'<div class="woocommerce-error">The minimum spend for membership discounts is $60.00.</div>'; */
    } else {
        $woocommerce->cart->add_discount($level);
        echo '<div class="woocommerce-message">Membership discount applied successfully.</div>';
        wc_clear_notices();
    }
}
开发者ID:keyshames,项目名称:tcm2016,代码行数:15,代码来源:functions.php

示例10: redirect_to_checkout

function redirect_to_checkout()
{
    wc_clear_notices();
    return WC()->cart->get_checkout_url();
}
开发者ID:pcuervo,项目名称:wp-yolcan,代码行数:5,代码来源:functions.php

示例11: process_payment

 /**
  * Process payment
  * @param $order_id
  * @param $data
  */
 public function process_payment($order_id, $data)
 {
     if (!isset($data['payment_details'])) {
         return;
     }
     // some gateways check if a user is signed in, so let's switch to customer
     $logged_in_user = get_current_user_id();
     $customer_id = isset($data['customer_id']) ? $data['customer_id'] : 0;
     wp_set_current_user($customer_id);
     // load the gateways & process payment
     $gateway_id = $data['payment_details']['method_id'];
     add_filter('option_woocommerce_' . $gateway_id . '_settings', array($this, 'force_enable_gateway'));
     $settings = WC_POS_Admin_Settings_Checkout::get_instance();
     $gateways = $settings->load_enabled_gateways();
     $response = $gateways[$gateway_id]->process_payment($order_id);
     if (isset($response['result']) && $response['result'] == 'success') {
         $this->payment_success($gateway_id, $order_id, $response);
     } else {
         $this->payment_failure($gateway_id, $order_id, $response);
     }
     // switch back to logged in user
     wp_set_current_user($logged_in_user);
     // clear any payment gateway messages
     wc_clear_notices();
 }
开发者ID:rpidanny,项目名称:WooCommerce-POS,代码行数:30,代码来源:class-wc-pos-orders.php

示例12: Frontpage

<?php

include_once 'front_template.php';
$obj = new Frontpage();
$obj->checkLogin();
wc_clear_notices();
if (isset($_GET['key']) && $_GET['key'] != '') {
    $_SESSION['checkout'] = 'Done';
    if (get_option('_skip_ga_ecommerce') == 1) {
        $url = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
        $template_name = strpos($url, '/order-received/') === false ? '/view-order/' : '/order-received/';
        if (strpos($url, $template_name) !== false) {
            $start = strpos($url, $template_name);
            $first_part = substr($url, $start + strlen($template_name));
            $order_id = substr($first_part, 0, strpos($first_part, '/'));
            //yes, I can retrieve the order via the order id
            $order = new WC_Order($order_id);
            $items_details = $order->get_items();
            $items = array();
            $i = 0;
            foreach ($items_details as $item) {
                //print_r($item);
                $product = $order->get_product_from_item($item);
                $product_id = $item['product_id'];
                $term_list = wp_get_post_terms($product_id, 'product_cat', array('fields' => 'ids'));
                $cat_id = (int) $term_list[0];
                $category = get_term($cat_id, 'product_cat');
                $items[$i]['name'] = $item['name'];
                $items[$i]['quantity'] = $item['qty'];
                $items[$i]['sku'] = $product->get_sku();
                $items[$i]['price'] = $product->get_price();
开发者ID:WP-Panda,项目名称:allergenics,代码行数:31,代码来源:step4.php

示例13: apply_form

 /**
  *
  *
  * @return unknown
  */
 public function apply_form()
 {
     global $woocommerce;
     if (!isset($_POST['apply_for_vendor'])) {
         return false;
     }
     if ($this->terms_page && !isset($_POST['agree_to_terms'])) {
         wc_clear_notices();
         wc_add_notice(__('You must accept the terms and conditions to become a vendor.', 'wcvendors'), 'error');
     } else {
         if (isset($_POST['apply_for_vendor_submit'])) {
             self::save_pending(get_current_user_id());
         }
     }
 }
开发者ID:soydiegomen,项目名称:plazajilo,代码行数:20,代码来源:class-vendor-signup.php

示例14: add_to_cart_redirect

 /**
  * For a smoother sign up process, tell WooCommerce to redirect the shopper immediately to
  * the checkout page after she clicks the "Sign Up Now" button
  *
  * Only enabled if multiple checkout is not enabled.
  *
  * @param string $url The cart redirect $url WooCommerce determined.
  * @since 1.0
  */
 public static function add_to_cart_redirect($url)
 {
     // If product is of the subscription type
     if (is_numeric($_REQUEST['add-to-cart']) && WC_Subscriptions_Product::is_subscription((int) $_REQUEST['add-to-cart']) && 'yes' != get_option(WC_Subscriptions_Admin::$option_prefix . '_multiple_purchase', 'no')) {
         wc_clear_notices();
         // Redirect to checkout
         $url = WC()->cart->get_checkout_url();
     }
     return $url;
 }
开发者ID:keshvenderg,项目名称:cloudshop,代码行数:19,代码来源:woocommerce-subscriptions.php

示例15: add_to_cart_redirect

 /**
  * For a smoother sign up process, tell WooCommerce to redirect the shopper immediately to
  * the checkout page after she clicks the "Sign Up Now" button
  *
  * Only enabled if multiple checkout is not enabled.
  *
  * @param string $url The cart redirect $url WooCommerce determined.
  * @since 1.0
  */
 public static function add_to_cart_redirect($url)
 {
     // If product is of the subscription type
     if (isset($_REQUEST['add-to-cart']) && is_numeric($_REQUEST['add-to-cart']) && WC_Subscriptions_Product::is_subscription((int) $_REQUEST['add-to-cart'])) {
         // Redirect to checkout if mixed checkout is disabled
         if ('yes' != get_option(WC_Subscriptions_Admin::$option_prefix . '_multiple_purchase', 'no')) {
             wc_clear_notices();
             $url = WC()->cart->get_checkout_url();
             // Redirect to the same page (if the customer wouldn't be redirected to the cart) to ensure the cart widget loads correctly
         } elseif ('yes' != get_option('woocommerce_cart_redirect_after_add')) {
             $url = remove_query_arg('add-to-cart');
         }
     }
     return $url;
 }
开发者ID:slavic18,项目名称:cats,代码行数:24,代码来源:woocommerce-subscriptions.php


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