تابع ووکامرسی wc_get_price_to_display نمایش قیمت محصول بدون / با (مالیات)

تابع ووکامرسی wc_get_price_to_display – نمایش قیمت محصول بدون / با (مالیات) با توجه به تنظیمات woocommerce_tax_display_shop
Syntax – سینتکس
(float) wc_get_price_to_display( (WC_Product) $product, (array) $args = array() );
Parameters – پارامتر ها (2)
- 1- $product (WC_Product)
- 2- $args (array)
Usage – نحوه استفاده
if ( !function_exists( 'wc_get_price_to_display' ) ) {
require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-product-functions.php';
}
// The product.
$product = null;
// The args.
$args = array();
// NOTICE! Understand what this does before running.
$result = wc_get_price_to_display($product, $args);
Defined – محل تعریف
/includes/wc-product-functions.php
function wc_get_price_to_display( $product, $args = array() ) {
$args = wp_parse_args( $args, array(
'qty' => 1,
'price' => $product->get_price(),
) );
$price = $args['price'];
$qty = $args['qty'];
return 'incl' === get_option( 'woocommerce_tax_display_shop' ) ? wc_get_price_including_tax( $product, array( 'qty' => $qty, 'price' => $price ) ) : wc_get_price_excluding_tax( $product, array( 'qty' => $qty, 'price' => $price ) );
}
versions – نسخه ها
از نسخه : 3.0.0
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر