當前位置: 首頁>>代碼示例>>PHP>>正文


PHP wc_price函數代碼示例

本文整理匯總了PHP中wc_price函數的典型用法代碼示例。如果您正苦於以下問題:PHP wc_price函數的具體用法?PHP wc_price怎麽用?PHP wc_price使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了wc_price函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: get_chart_legend

 /**
  * Get the legend for the main chart sidebar
  * @return array
  */
 public function get_chart_legend()
 {
     $legend = array();
     $order_totals = $this->get_order_report_data(array('data' => array('_order_total' => array('type' => 'meta', 'function' => 'SUM', 'name' => 'total_sales'), '_order_shipping' => array('type' => 'meta', 'function' => 'SUM', 'name' => 'total_shipping'), 'ID' => array('type' => 'post_data', 'function' => 'COUNT', 'name' => 'total_orders')), 'filter_range' => true));
     $total_sales = $order_totals->total_sales;
     $total_shipping = $order_totals->total_shipping;
     $total_orders = absint($order_totals->total_orders);
     $total_items = absint($this->get_order_report_data(array('data' => array('_qty' => array('type' => 'order_item_meta', 'order_item_type' => 'line_item', 'function' => 'SUM', 'name' => 'order_item_qty')), 'query_type' => 'get_var', 'filter_range' => true)));
     // Get discount amounts in range
     $total_coupons = $this->get_order_report_data(array('data' => array('discount_amount' => array('type' => 'order_item_meta', 'order_item_type' => 'coupon', 'function' => 'SUM', 'name' => 'discount_amount')), 'where' => array(array('key' => 'order_item_type', 'value' => 'coupon', 'operator' => '=')), 'query_type' => 'get_var', 'filter_range' => true));
     $this->average_sales = $total_sales / ($this->chart_interval + 1);
     switch ($this->chart_groupby) {
         case 'day':
             $average_sales_title = sprintf(__('%s average daily sales', 'woocommerce'), '<strong>' . wc_price($this->average_sales) . '</strong>');
             break;
         case 'month':
             $average_sales_title = sprintf(__('%s average monthly sales', 'woocommerce'), '<strong>' . wc_price($this->average_sales) . '</strong>');
             break;
     }
     $legend[] = array('title' => sprintf(__('%s sales in this period', 'woocommerce'), '<strong>' . wc_price($total_sales) . '</strong>'), 'color' => $this->chart_colours['sales_amount'], 'highlight_series' => 5);
     $legend[] = array('title' => $average_sales_title, 'color' => $this->chart_colours['average'], 'highlight_series' => 2);
     $legend[] = array('title' => sprintf(__('%s orders placed', 'woocommerce'), '<strong>' . $total_orders . '</strong>'), 'color' => $this->chart_colours['order_count'], 'highlight_series' => 1);
     $legend[] = array('title' => sprintf(__('%s items purchased', 'woocommerce'), '<strong>' . $total_items . '</strong>'), 'color' => $this->chart_colours['item_count'], 'highlight_series' => 0);
     $legend[] = array('title' => sprintf(__('%s charged for shipping', 'woocommerce'), '<strong>' . wc_price($total_shipping) . '</strong>'), 'color' => $this->chart_colours['shipping_amount'], 'highlight_series' => 4);
     $legend[] = array('title' => sprintf(__('%s worth of coupons used', 'woocommerce'), '<strong>' . wc_price($total_coupons) . '</strong>'), 'color' => $this->chart_colours['coupon_amount'], 'highlight_series' => 3);
     return $legend;
 }
開發者ID:prosenjit-itobuz,項目名稱:nutraperfect,代碼行數:31,代碼來源:class-wc-report-sales-by-date.php

示例2: test_wc_cart_totals_subtotal_html

 /**
  * Test wc_cart_totals_subtotal_html()
  *
  * @todo  test with taxes incl./excl.
  * @since 2.4
  */
 public function test_wc_cart_totals_subtotal_html()
 {
     $product = \WC_Helper_Product::create_simple_product();
     WC()->cart->add_to_cart($product->id, 1);
     $this->expectOutputString(wc_price($product->price), wc_cart_totals_subtotal_html());
     \WC_Helper_Product::delete_product($product->id);
 }
開發者ID:noman1059,項目名稱:woocommerce,代碼行數:13,代碼來源:functions.php

示例3: get_chart_legend

 /**
  * Get the legend for the main chart sidebar
  * @return array
  */
 public function get_chart_legend()
 {
     if (!$this->show_categories) {
         return array();
     }
     $legend = array();
     $index = 0;
     foreach ($this->show_categories as $category) {
         $category = get_term($category, 'product_cat');
         $term_ids = get_term_children($category->term_id, 'product_cat');
         $term_ids[] = $category->term_id;
         $total = 0;
         $product_ids = array_unique(get_objects_in_term($term_ids, 'product_cat'));
         foreach ($product_ids as $id) {
             if (isset($this->item_sales[$id])) {
                 $total += $this->item_sales[$id];
             }
         }
         //if ( ! $total )
         //	continue;
         $legend[] = array('title' => sprintf(__('%s sales in %s', 'woocommerce'), '<strong>' . wc_price($total) . '</strong>', $category->name), 'color' => isset($this->chart_colours[$index]) ? $this->chart_colours[$index] : $this->chart_colours[0], 'highlight_series' => $index);
         $index++;
     }
     return $legend;
 }
開發者ID:hoonio,項目名稱:PhoneAfrika,代碼行數:29,代碼來源:class-wc-report-sales-by-category.php

示例4: column_default

 function column_default($item, $column_name)
 {
     global $CPT_Product, $post, $the_product;
     if (is_null($post) || (int) $item->ID != (int) $post->ID) {
         $post = get_post($item->ID);
         if (is_null($post)) {
             return;
         }
     }
     switch ($column_name) {
         case 'thumb':
         case 'name':
         case 'sku':
         case 'is_in_stock':
         case 'price':
         case 'product_cat':
         case 'product_type':
         case 'date':
         case 'crm_actions':
             return $CPT_Product->render_product_columns($column_name);
         case 'number_purchased':
             return $item->items_count;
             break;
         case 'value_purchases':
             return wc_price($item->line_total);
         default:
             return print_r($item, true);
             //Show the whole array for troubleshooting purposes
     }
 }
開發者ID:daanbakker1995,項目名稱:vanteun,代碼行數:30,代碼來源:class-wc-crm-table-customer-products-purchased.php

示例5: woocommerce_grouped_price_html

 public static function woocommerce_grouped_price_html($price, $product)
 {
     $tax_display_mode = get_option('woocommerce_tax_display_shop');
     $child_prices = array();
     foreach ($product->get_children() as $child_id) {
         //$child_prices[] = get_post_meta( $child_id, '_price', true );
         $child = get_product($child_id);
         $child_prices[] = $child->get_price();
     }
     $child_prices = array_unique($child_prices);
     $get_price_method = 'get_price_' . $tax_display_mode . 'uding_tax';
     if (!empty($child_prices)) {
         $min_price = min($child_prices);
         $max_price = max($child_prices);
     } else {
         $min_price = '';
         $max_price = '';
     }
     if ($min_price) {
         if ($min_price == $max_price) {
             $display_price = wc_price($product->{$get_price_method}(1, $min_price));
         } else {
             $from = wc_price($product->{$get_price_method}(1, $min_price));
             $to = wc_price($product->{$get_price_method}(1, $max_price));
             $display_price = sprintf(_x('%1$s&ndash;%2$s', 'Price range: from-to', 'woocommerce'), $from, $to);
         }
         $price = $display_price . $product->get_price_suffix();
     }
     return $price;
 }
開發者ID:pellio11,項目名稱:ns-select-project,代碼行數:30,代碼來源:class-wrp-grouped-admin.php

示例6: get_chart_legend

 /**
  * Get the legend for the main chart sidebar
  * @return array
  */
 public function get_chart_legend()
 {
     $legend = array();
     $total_orders = $this->get_order_report_data(array('data' => array('ID' => array('type' => 'post_data', 'function' => 'COUNT', 'name' => 'total_orders')), 'query_type' => 'get_var', 'filter_range' => true));
     $total_sales = $this->get_order_report_data(array('data' => array('_line_subtotal' => array('type' => 'order_item_meta', 'order_item_type' => 'line_item', 'function' => 'SUM', 'name' => 'total_item_sales')), 'query_type' => 'get_var', 'filter_range' => true));
     $total_items = absint($this->get_order_report_data(array('data' => array('_qty' => array('type' => 'order_item_meta', 'order_item_type' => 'line_item', 'function' => 'SUM', 'name' => 'order_item_qty')), 'query_type' => 'get_var', 'filter_range' => true)));
     $total_cog = $this->get_order_report_data(array('data' => array('_line_funkwoocost_order' => array('type' => 'order_item_meta', 'order_item_type' => 'line_item', 'function' => 'SUM', 'name' => 'total_cog')), 'query_type' => 'get_var', 'filter_range' => true));
     $total_profit = $total_sales - $total_cog;
     $total_profit < 0 ? $total_profit = 0 : 0;
     $this->average_sales = $total_sales / ($this->chart_interval + 1);
     switch ($this->chart_groupby) {
         case 'day':
             $average_sales_title = sprintf(__('%s average daily sales', 'woocommerce'), '<strong>' . wc_price($this->average_sales) . '</strong>');
             break;
         case 'month':
             $average_sales_title = sprintf(__('%s average monthly sales', 'woocommerce'), '<strong>' . wc_price($this->average_sales) . '</strong>');
             break;
     }
     $legend[] = array('title' => sprintf(__('%s item sales in this period', 'funkwoocost'), '<strong>' . wc_price($total_sales) . '</strong>'), 'placeholder' => __('This is the sum of the order totals after any refunds and excluding shipping and taxes.', 'funkwoocost'), 'color' => $this->chart_colours['sales_amount'], 'highlight_series' => 4);
     $legend[] = array('title' => sprintf(__('%s item profits in this period', 'funkwoocost'), '<strong>' . wc_price($total_profit) . '</strong>'), 'placeholder' => __('This is the sum of the order totals after deducting by cost of goods, any refunds and excluding shipping and taxes.', 'funkwoocost'), 'color' => $this->chart_colours['profit_amount'], 'highlight_series' => 3);
     $legend[] = array('title' => $average_sales_title, 'color' => $this->chart_colours['average'], 'highlight_series' => 2);
     $legend[] = array('title' => sprintf(__('%s orders placed', 'woocommerce'), '<strong>' . $total_orders . '</strong>'), 'color' => $this->chart_colours['order_count'], 'highlight_series' => 1);
     $legend[] = array('title' => sprintf(__('%s items purchased', 'woocommerce'), '<strong>' . $total_items . '</strong>'), 'color' => $this->chart_colours['item_count'], 'highlight_series' => 0);
     return $legend;
 }
開發者ID:qutek,項目名稱:Woocommerce-Product-Costs,代碼行數:29,代碼來源:report-profit-by-date.class.php

示例7: get_user_balance

 /**
  * return user balance formated as dollars
  * @return [type] [description]
  */
 function get_user_balance()
 {
     $current_user_balance = get_user_meta($_POST['user_id'], '_uw_balance', true);
     $return = array('status' => true, 'balance' => wc_price($current_user_balance));
     print json_encode($return);
     exit;
 }
開發者ID:justingreerbbi,項目名稱:user-waller-credit-system,代碼行數:11,代碼來源:ajax.php

示例8: get_formatted_order_total

 /**
  * Gets order total - formatted for display.
  *
  * @return string
  */
 public function get_formatted_order_total($tax_display = '', $display_refunded = true)
 {
     $formatted_total = wc_price($this->get_total(), array('currency' => $this->get_order_currency()));
     $order_total = $this->get_total();
     $total_refunded = $this->get_total_refunded();
     $tax_string = '';
     // Tax for inclusive prices
     if (wc_tax_enabled() && 'incl' == $tax_display) {
         $tax_string_array = array();
         if ('itemized' == get_option('woocommerce_tax_total_display')) {
             foreach ($this->get_tax_totals() as $code => $tax) {
                 $tax_amount = $total_refunded && $display_refunded ? wc_price(WC_Tax::round($tax->amount - $this->get_total_tax_refunded_by_rate_id($tax->rate_id)), array('currency' => $this->get_order_currency())) : $tax->formatted_amount;
                 $tax_string_array[] = sprintf('%s %s', $tax_amount, $tax->label);
             }
         } else {
             $tax_amount = $total_refunded && $display_refunded ? $this->get_total_tax() - $this->get_total_tax_refunded() : $this->get_total_tax();
             $tax_string_array[] = sprintf('%s %s', wc_price($tax_amount, array('currency' => $this->get_order_currency())), WC()->countries->tax_or_vat());
         }
         if (!empty($tax_string_array)) {
             $tax_string = ' ' . sprintf(__('(Includes %s)', 'woocommerce'), implode(', ', $tax_string_array));
         }
     }
     if ($total_refunded && $display_refunded) {
         $formatted_total = '<del>' . strip_tags($formatted_total) . '</del> <ins>' . wc_price($order_total - $total_refunded, array('currency' => $this->get_order_currency())) . $tax_string . '</ins>';
     } else {
         $formatted_total .= $tax_string;
     }
     return apply_filters('woocommerce_get_formatted_order_total', $formatted_total, $this);
 }
開發者ID:magicdustwebsites,項目名稱:woocommerce,代碼行數:34,代碼來源:class-wc-order.php

示例9: 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

示例10: francotecnologia_wc_parcpagseg_get_parceled_table

function francotecnologia_wc_parcpagseg_get_parceled_table($price = null)
{
    $price = francotecnologia_wc_parcpagseg_get_price($price);
    if ($price > 0) {
        $installments = francotecnologia_wc_parcpagseg_get_installments($price);
        $table = '<table class="francotecnologia_wc_parcpagseg_table">';
        $table .= '<tr>';
        $table .= str_repeat('<th>Parcelas</th><th>Valor</th>', $installments > 1 ? 2 : 1);
        $table .= '</tr>';
        foreach (range(1, $installments) as $parcel) {
            $calc = francotecnologia_wc_parcpagseg_calculate_installment($price, $parcel);
            if ($parcel % 2 == 1) {
                $table .= '<tr>';
            }
            $table .= '<th>' . $parcel . '</th><td>' . wc_price($calc->price) . '</td>';
            if ($parcel % 2 == 0) {
                $table .= '</tr>';
            }
        }
        if (substr($table, -5) != '</tr>') {
            $table .= '</tr>';
        }
        $table .= '</table>';
        return $table;
    } else {
        return '';
    }
}
開發者ID:englsergio,項目名稱:allsensations,代碼行數:28,代碼來源:woocommerce-installments.php

示例11: get_chart_legend

 /**
  * Get the legend for the main chart sidebar
  * @return array
  */
 public function get_chart_legend()
 {
     $legend = array();
     $total_orders = absint($this->get_order_report_data(array('data' => array('ID' => array('type' => 'post_data', 'function' => 'COUNT', 'name' => 'total_orders')), 'query_type' => 'get_var', 'filter_range' => true, 'order_types' => wc_get_order_types('order-count'), 'order_status' => array('completed', 'processing', 'on-hold', 'refunded'))));
     $total_items = absint($this->get_order_report_data(array('data' => array('_qty' => array('type' => 'order_item_meta', 'order_item_type' => 'line_item', 'function' => 'SUM', 'name' => 'order_item_qty')), 'query_type' => 'get_var', 'order_types' => wc_get_order_types('order-count'), 'order_status' => array('completed', 'processing', 'on-hold', 'refunded'), 'filter_range' => true)));
     $total_coupons = $this->get_order_report_data(array('data' => array('discount_amount' => array('type' => 'order_item_meta', 'order_item_type' => 'coupon', 'function' => 'SUM', 'name' => 'discount_amount')), 'where' => array(array('key' => 'order_items.order_item_type', 'value' => 'coupon', 'operator' => '=')), 'query_type' => 'get_var', 'order_types' => wc_get_order_types('order-count'), 'order_status' => array('completed', 'processing', 'on-hold', 'refunded'), 'filter_range' => true));
     $order_totals = $this->get_order_report_data(array('data' => array('_order_total' => array('type' => 'meta', 'function' => 'SUM', 'name' => 'total_sales'), '_order_shipping' => array('type' => 'meta', 'function' => 'SUM', 'name' => 'total_shipping'), '_order_tax' => array('type' => 'meta', 'function' => 'SUM', 'name' => 'total_tax'), '_order_shipping_tax' => array('type' => 'meta', 'function' => 'SUM', 'name' => 'total_shipping_tax')), 'order_types' => wc_get_order_types('sales-reports'), 'order_status' => array('completed', 'processing', 'on-hold', 'refunded'), 'filter_range' => true));
     $partial_refunds = $this->get_order_report_data(array('data' => array('_refund_amount' => array('type' => 'meta', 'function' => 'SUM', 'name' => 'total_refund')), 'query_type' => 'get_var', 'order_types' => array('shop_order_refund'), 'filter_range' => true, 'order_status' => false, 'parent_order_status' => array('completed', 'processing', 'on-hold')));
     $full_refunds = $this->get_order_report_data(array('data' => array('_order_total' => array('type' => 'meta', 'function' => 'SUM', 'name' => 'total_sales')), 'query_type' => 'get_var', 'order_types' => wc_get_order_types('sales-reports'), 'order_status' => array('refunded'), 'filter_range' => true));
     $total_sales = $order_totals->total_sales;
     $total_shipping = $order_totals->total_shipping;
     $total_tax = $order_totals->total_tax;
     $total_shipping_tax = $order_totals->total_shipping_tax;
     $net_sales = $order_totals->total_sales - $total_shipping - $total_tax - $total_shipping_tax;
     $total_refunds = $partial_refunds + $full_refunds;
     $this->average_sales = $total_sales / ($this->chart_interval + 1);
     switch ($this->chart_groupby) {
         case 'day':
             $average_sales_title = sprintf(__('%s average daily sales', 'woocommerce'), '<strong>' . wc_price($this->average_sales) . '</strong>');
             break;
         case 'month':
         default:
             $average_sales_title = sprintf(__('%s average monthly sales', 'woocommerce'), '<strong>' . wc_price($this->average_sales) . '</strong>');
             break;
     }
     $legend[] = array('title' => sprintf(__('%s gross sales in this period', 'woocommerce'), '<strong>' . wc_price($total_sales) . '</strong>'), 'placeholder' => __('This is the sum of the order totals, including shipping and taxes. This does not include refunds.', 'woocommerce'), 'color' => $this->chart_colours['sales_amount'], 'highlight_series' => 6);
     $legend[] = array('title' => sprintf(__('%s net sales in this period', 'woocommerce'), '<strong>' . wc_price($net_sales) . '</strong>'), 'placeholder' => __('This is the net sales figure excluding shipping and taxes. This does not include refunds.', 'woocommerce'), 'color' => $this->chart_colours['net_sales_amount'], 'highlight_series' => 7);
     $legend[] = array('title' => $average_sales_title, 'color' => $this->chart_colours['average'], 'highlight_series' => 2);
     $legend[] = array('title' => sprintf(__('%s orders placed', 'woocommerce'), '<strong>' . $total_orders . '</strong>'), 'color' => $this->chart_colours['order_count'], 'highlight_series' => 1);
     $legend[] = array('title' => sprintf(__('%s items purchased', 'woocommerce'), '<strong>' . $total_items . '</strong>'), 'color' => $this->chart_colours['item_count'], 'highlight_series' => 0);
     $legend[] = array('title' => sprintf(__('%s charged for shipping', 'woocommerce'), '<strong>' . wc_price($total_shipping) . '</strong>'), 'color' => $this->chart_colours['shipping_amount'], 'highlight_series' => 5);
     $legend[] = array('title' => sprintf(__('%s in refunds', 'woocommerce'), '<strong>' . wc_price($total_refunds) . '</strong>'), 'color' => $this->chart_colours['refund_amount'], 'highlight_series' => 4);
     $legend[] = array('title' => sprintf(__('%s worth of coupons used', 'woocommerce'), '<strong>' . wc_price($total_coupons) . '</strong>'), 'color' => $this->chart_colours['coupon_amount'], 'highlight_series' => 3);
     return $legend;
 }
開發者ID:ayoayco,項目名稱:upbeat,代碼行數:39,代碼來源:class-wc-report-sales-by-date.php

示例12: get_chart_legend

 /**
  * Get the legend for the main chart sidebar
  * @return array
  */
 public function get_chart_legend()
 {
     $legend = array();
     $total_sales = $this->get_order_report_data(array('data' => array('et_order_total' => array('type' => 'meta', 'function' => 'SUM', 'name' => 'total_sales')), 'query_type' => 'get_var', 'order_types' => array('order'), 'order_status' => array('publish'), 'filter_range' => true));
     $total_pending = $this->get_order_report_data(array('data' => array('et_order_total' => array('type' => 'meta', 'function' => 'SUM', 'name' => 'total_sales'), 'ID' => array('type' => 'post_data', 'function' => 'COUNT', 'name' => 'total_orders')), 'query_type' => 'get_row', 'order_types' => array('order'), 'order_status' => array('pending'), 'filter_range' => true));
     $total_draft = $this->get_order_report_data(array('data' => array('et_order_total' => array('type' => 'meta', 'function' => 'SUM', 'name' => 'total_sales'), 'ID' => array('type' => 'post_data', 'function' => 'COUNT', 'name' => 'total_orders')), 'query_type' => 'get_row', 'order_types' => array('order'), 'order_status' => array('draft'), 'filter_range' => true));
     $total_paid = absint($this->get_order_report_data(array('data' => array('ID' => array('type' => 'post_data', 'function' => 'COUNT', 'name' => 'total_orders')), 'query_type' => 'get_var', 'filter_range' => true, 'order_types' => array('order'), 'order_status' => array('publish'))));
     $this->average_sales = $total_sales / ($this->chart_interval + 1);
     switch ($this->chart_groupby) {
         case 'day':
             $average_sales_title = sprintf(__('%s average daily sales', 'woocommerce'), '<strong>' . wc_price($this->average_sales) . '</strong>');
             break;
         case 'month':
             $average_sales_title = sprintf(__('%s average monthly sales', 'woocommerce'), '<strong>' . wc_price($this->average_sales) . '</strong>');
             break;
     }
     $legend[] = array('title' => sprintf(__('%s sales in this period', 'woocommerce'), '<strong>' . wc_price($total_sales) . '</strong>'), 'color' => $this->chart_colours['sales_amount'], 'highlight_series' => 4);
     $legend[] = array('title' => sprintf(__('%s Pending sales', 'woocommerce'), '<strong>' . wc_price($total_pending->total_sales) . '</strong>'), 'color' => $this->chart_colours['sales_pending'], 'highlight_series' => 6);
     $legend[] = array('title' => sprintf(__('%s draft sales', 'woocommerce'), '<strong>' . wc_price($total_draft->total_sales) . '</strong>'), 'color' => $this->chart_colours['sales_draft'], 'highlight_series' => 5);
     $legend[] = array('title' => $average_sales_title, 'color' => $this->chart_colours['average'], 'highlight_series' => 3);
     $legend[] = array('title' => sprintf(__('%s paid orders', 'woocommerce'), '<strong>' . $total_paid . '</strong>'), 'color' => $this->chart_colours['order_count'], 'highlight_series' => 0);
     $legend[] = array('title' => sprintf(__('%s pending orders', 'woocommerce'), '<strong>' . $total_pending->total_orders . '</strong>'), 'color' => $this->chart_colours['order_pending'], 'highlight_series' => 2);
     $legend[] = array('title' => sprintf(__('%s draft orders', 'woocommerce'), '<strong>' . $total_draft->total_orders . '</strong>'), 'color' => $this->chart_colours['order_draft'], 'highlight_series' => 1);
     return $legend;
 }
開發者ID:linniepinski,項目名稱:perssistant,代碼行數:29,代碼來源:class-ce-report-order-by-seller.php

示例13: wc_autoship_upsell_cart_item_name

function wc_autoship_upsell_cart_item_name($name, $item, $item_key)
{
    if (!is_cart()) {
        return $name;
    }
    $product_id = $item['product_id'];
    $autoship_enabled = get_post_meta($product_id, '_wc_autoship_enable_autoship', true);
    if ($autoship_enabled != 'yes') {
        // No autoship
        return $name;
    }
    $var_product_id = !empty($item['variation_id']) ? $item['variation_id'] : $item['product_id'];
    $product = wc_get_product($var_product_id);
    $price = $product->get_price();
    $autoship_price = (double) apply_filters('wc_autoship_price', get_post_meta($var_product_id, '_wc_autoship_price', true), $var_product_id, 0, get_current_user_id(), 0);
    $diff = $product->get_price() - $autoship_price;
    $upsell_title = '';
    $upsell_class = '';
    if (isset($item['wc_autoship_frequency'])) {
        $upsell_title = __('<span class="wc-autoship-upsell-icon">&#9998;</span> Change Auto-Ship', 'wc-autoship-upsell');
        $upsell_class = 'wc-autoship-upsell-change-autoship';
    } elseif ($autoship_price > 0 && $diff > 0) {
        $upsell_title = __('<span class="wc-autoship-upsell-icon">&plus;</span>Save ' . wc_price($diff) . ' with Auto-Ship', 'wc-autoship-upsell');
        $upsell_class = 'wc-autoship-upsell-add-autoship-savings';
    } else {
        $upsell_title = __('<span class="wc-autoship-upsell-icon">&plus;</span>Add to Auto-Ship', 'wc-autoship-upsell');
        $upsell_class = 'wc-autoship-upsell-add-autoship';
    }
    $upsell_title = apply_filters('wc-autoship-upsell-title', $upsell_title, $item, $item_key);
    ob_start();
    ?>
			<div class="wc-autoship-upsell-container <?php 
    echo $upsell_class;
    ?>
">
				<button type="button" class="wc-autoship-upsell-cart-toggle"
					data-cart-item-key="<?php 
    echo esc_attr($item_key);
    ?>
"
					data-product-id="<?php 
    echo esc_attr($product->id);
    ?>
"
					data-remove-from-cart-url="<?php 
    echo esc_attr(WC()->cart->get_remove_url($item_key));
    ?>
"
					data-add-to-cart-url="<?php 
    echo esc_attr($product->add_to_cart_url());
    ?>
"><?php 
    echo $upsell_title;
    ?>
</button>
			</div>
		<?php 
    $upsell_content = ob_get_clean();
    return $name . $upsell_content;
}
開發者ID:patternsinthecloud,項目名稱:woocommerce-autoship-upsell,代碼行數:60,代碼來源:woocommerce-autoship-upsell.php

示例14: wc_price

 public static function wc_price($price)
 {
     if (self::is_wc_version_gte_2_1()) {
         return wc_price($price);
     } else {
         return woocommerce_price($price);
     }
 }
開發者ID:GarryVeles,項目名稱:Artibaltika,代碼行數:8,代碼來源:class-wc-dynamic-pricing-compatibility.php

示例15: wcml_convert_price

 function wcml_convert_price($formatted, $unformatted)
 {
     if (!is_admin()) {
         $currency = apply_filters('wcml_price_currency', get_woocommerce_currency());
         $formatted = strip_tags(wc_price(apply_filters('wcml_raw_price_amount', $unformatted), array('currency' => $currency)));
     }
     return $formatted;
 }
開發者ID:yjhcfzx,項目名稱:test_woo,代碼行數:8,代碼來源:class-wcml-gravityforms.php


注:本文中的wc_price函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。