当前位置: 首页>>代码示例>>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;未经允许,请勿转载。