تابع ووکامرسی wc_cart_totals_coupon_html دریافت کد html کوپن محصول یا سفارش

تابع ووکامرسی wc_cart_totals_coupon_html – دریافت کد html اچ تی ام ال کوپن محصول یا سفارش
Syntax – سینتکس
wc_cart_totals_coupon_html( (string) $coupon );
Parameters – پارامتر ها (1)
- 1- $coupon (string)
Usage – نحوه استفاده
if ( !function_exists( 'wc_cart_totals_coupon_html' ) ) {
require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-cart-functions.php';
}
// The coupon.
$coupon = '';
// NOTICE! Understand what this does before running.
$result = wc_cart_totals_coupon_html($coupon);
Defined – محل تعریف
/includes/wc-cart-functions.php
function wc_cart_totals_coupon_html( $coupon ) {
if ( is_string( $coupon ) ) {
$coupon = new WC_Coupon( $coupon );
}
$discount_amount_html = '';
if ( $amount = WC()->cart->get_coupon_discount_amount( $coupon->get_code(), WC()->cart->display_cart_ex_tax ) ) {
$discount_amount_html = '-' . wc_price( $amount );
} elseif ( $coupon->get_free_shipping() ) {
$discount_amount_html = __( 'Free shipping coupon', woocommerce );
}
$discount_amount_html = apply_filters( 'woocommerce_coupon_discount_amount_html', $discount_amount_html, $coupon );
$coupon_html = $discount_amount_html . ' ' . __( '[Remove]', woocommerce ) . '';
echo wp_kses( apply_filters( 'woocommerce_cart_totals_coupon_html', $coupon_html, $coupon, $discount_amount_html ), array_replace_recursive( wp_kses_allowed_html( 'post' ), array( 'a' => array( 'data-coupon' => true ) ) ) );
}
versions – نسخه ها
از نسخه : 3.0.2
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر