本文整理汇总了PHP中wc_cart_totals_shipping_method_label函数的典型用法代码示例。如果您正苦于以下问题:PHP wc_cart_totals_shipping_method_label函数的具体用法?PHP wc_cart_totals_shipping_method_label怎么用?PHP wc_cart_totals_shipping_method_label使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wc_cart_totals_shipping_method_label函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: esc_attr
?>
" value="<?php
echo esc_attr($method->id);
?>
" <?php
checked($method->id, $chosen_method);
?>
class="shipping_method" />
<label for="shipping_method_<?php
echo esc_attr($index);
?>
_<?php
echo sanitize_title($method->id);
?>
"><?php
echo wp_kses_post(wc_cart_totals_shipping_method_label($method));
?>
</label>
</li>
<?php
}
?>
</ul>
<?php
}
?>
<?php
} elseif (!WC()->customer->get_shipping_state() || !WC()->customer->get_shipping_postcode()) {
?>
示例2: printf
<?php
printf('<input type="radio" name="shipping_method[%1$d]" data-index="%1$d" id="shipping_method_%1$d_%2$s" value="%3$s" class="shipping_method" %4$s />
<label for="shipping_method_%1$d_%2$s">%5$s</label>', $index, sanitize_title($method->id), esc_attr($method->id), checked($method->id, $chosen_method, false), wc_cart_totals_shipping_method_label($method));
do_action('woocommerce_after_shipping_rate', $method, $index);
?>
</li>
<?php
}
?>
</ul>
<?php
} elseif (1 === count($available_methods)) {
?>
<?php
$method = current($available_methods);
printf('%3$s <input type="hidden" name="shipping_method[%1$d]" data-index="%1$d" id="shipping_method_%1$d" value="%2$s" class="shipping_method" />', $index, esc_attr($method->id), wc_cart_totals_shipping_method_label($method));
do_action('woocommerce_after_shipping_rate', $method, $index);
?>
<?php
} elseif (!WC()->customer->has_calculated_shipping()) {
?>
<?php
echo wpautop(__('Shipping costs will be calculated once you have provided your address.', 'woocommerce'));
?>
<?php
} else {
?>
<?php
echo apply_filters(is_cart() ? 'woocommerce_cart_no_shipping_available_html' : 'woocommerce_no_shipping_available_html', wpautop(__('There are no shipping methods available. Please double check your address, or contact us if you need any help.', 'woocommerce')));
?>
<?php
示例3: woocommerce_cart_totals_shipping_method_label
/**
* @deprecated
*/
function woocommerce_cart_totals_shipping_method_label($method)
{
return wc_cart_totals_shipping_method_label($method);
}
示例4: elseif
<?php elseif ( get_option( 'woocommerce_shipping_method_format' ) === 'select' ) : ?>
<select name="shipping_method[<?php echo $index; ?>]" data-index="<?php echo $index; ?>" id="shipping_method_<?php echo $index; ?>" class="shipping_method">
<?php foreach ( $available_methods as $method ) : ?>
<option value="<?php echo esc_attr( $method->id ); ?>" <?php selected( $method->id, $chosen_method ); ?>><?php echo wp_kses_post( wc_cart_totals_shipping_method_label( $method ) ); ?></option>
<?php endforeach; ?>
</select>
<?php
else : ?>
<ul id="shipping_method">
<?php foreach ( $available_methods as $method ) : ?>
<li>
<input type="radio" name="shipping_method[<?php echo $index; ?>]" data-index="<?php echo $index; ?>" id="shipping_method_<?php echo $index; ?>_<?php echo sanitize_title( $method->id ); ?>" value="<?php echo esc_attr( $method->id ); ?>" <?php checked( $method->id, $chosen_method ); ?> class="shipping_method" />
<label for="shipping_method_<?php echo $index; ?>_<?php echo sanitize_title( $method->id ); ?>"><?php echo wp_kses_post( wc_cart_totals_shipping_method_label( $method ) ); ?></label>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php elseif ( ! WC()->customer->get_shipping_state() || ! WC()->customer->get_shipping_postcode() ) : ?>
<?php if ( is_cart() ) : ?>
<p><?php echo $noshipping_found; ?></p>
<?php else : ?>
<p><?php echo $please_fill; ?></p>
示例5: esc_attr
?>
" value="<?php
echo esc_attr($method->id);
?>
" <?php
checked($method->id, $chosen_method);
?>
class="shipping_method" />
<label for="shipping_method_<?php
echo $index;
?>
_<?php
echo sanitize_title($method->id);
?>
"><?php
echo wp_kses_post(str_replace("Entrega em", "", wc_cart_totals_shipping_method_label($method)));
?>
</label>
</li>
<?php
}
?>
</ul>
<?php
}
?>
<?php
} elseif (!WC()->customer->get_shipping_state() || !WC()->customer->get_shipping_postcode()) {
?>
示例6: esc_attr
?>
" value="<?php
echo esc_attr($method->id);
?>
" <?php
checked($method->id, $chosen_method);
?>
class="shipping_method" />
<label for="shipping_method_<?php
echo $index;
?>
_<?php
echo sanitize_title($method->id);
?>
"><?php
echo wc_cart_totals_shipping_method_label($method);
?>
</label>
</li>
<?php
}
?>
</ul>
<?php
}
?>
<?php
if ($show_package_details) {
?>
示例7: render_shipping_row
//.........这里部分代码省略.........
if ($woocommerce->cart->display_totals_ex_tax || !$woocommerce->cart->prices_include_tax) {
if ($shipping_tax > 0) {
if ($woocommerce->cart->prices_include_tax) {
$method->label .= woocommerce_price($method->cost) . ' ' . $woocommerce->countries->ex_tax_or_vat();
} else {
$method->label .= woocommerce_price($method->cost);
}
} else {
$method->label .= woocommerce_price($method->cost);
}
} else {
$method->label .= woocommerce_price($method->cost + $shipping_tax);
if ($shipping_tax > 0 && !$woocommerce->cart->prices_include_tax) {
$method->label .= ' ' . $woocommerce->countries->inc_tax_or_vat();
}
}
}
$shipping_methods[] = $method;
}
// Print a single available shipping method as plain text
if (1 === count($shipping_methods)) {
$method = $shipping_methods[0];
echo $method->label;
echo '<input type="hidden" class="shipping_methods shipping_method" name="' . $field_name . '[' . $x . ']" value="' . esc_attr($method->id) . '||' . strip_tags($method->label) . '">';
// Show multiple shipping methods in a select list
} elseif (count($shipping_methods) > 1) {
echo '<select class="shipping_methods shipping_method" name="' . $field_name . '[' . $x . ']">';
foreach ($shipping_methods as $method) {
if ($method->id == 'multiple_shipping') {
continue;
}
$current_selected = isset($selected[$x]) ? $selected[$x]['id'] : '';
echo '<option value="' . esc_attr($method->id) . '||' . strip_tags($method->label) . '" ' . selected($current_selected, $method->id, false) . '>';
if (function_exists('wc_cart_totals_shipping_method_label')) {
echo wp_kses_post(wc_cart_totals_shipping_method_label($method));
} else {
echo strip_tags($method->label);
}
echo '</option>';
}
echo '</select>';
} else {
echo '<p>' . __('(2) Sorry, it seems that there are no available shipping methods for your state. Please contact us if you require assistance or wish to make alternate arrangements.', 'woocommerce') . '</p>';
}
$sess_cart_addresses = wcms_session_get('cart_item_addresses');
if ($sess_cart_addresses && !empty($sess_cart_addresses)) {
echo '<p><a href="' . get_permalink($page_id) . '" class="modify-address-button">' . __('Modify address', 'wc_shipping_multiple_address') . '</a></p>';
}
?>
</div>
<?php
}
}
?>
<div style="clear:both;"></div>
<?php
if (!function_exists('wc_add_notice')) {
?>
<input type="hidden" name="shipping_method" value="multiple_shipping" />
<?php
}
?>
</div>
</td>
示例8: klarna_checkout_get_shipping_options_row_html
/**
*
*
* /**
* Gets shipping options as formatted HTML.
*
* @since 2.0
**/
function klarna_checkout_get_shipping_options_row_html()
{
global $woocommerce;
ob_start();
if (!defined('WOOCOMMERCE_CART')) {
define('WOOCOMMERCE_CART', true);
}
$woocommerce->cart->calculate_shipping();
$woocommerce->cart->calculate_fees();
$woocommerce->cart->calculate_totals();
?>
<tr id="kco-page-shipping">
<?php
// if ( WC()->session->get( 'klarna_is_rest', false ) ) { // Just show shipping cost for Rest
// Temporarily commented out while Klarna works on this feaure and replaced by the check below
// that always returns true.
?>
<?php
if (1 > 2) {
// Just show shipping cost for Rest
?>
<td class="kco-rightalign">
<?php
_e('Shipping', 'woocommerce-gateway-klarna');
?>
</td>
<td id="kco-page-shipping-total">
<?php
echo $woocommerce->cart->get_cart_shipping_total();
?>
</td>
<?php
} else {
?>
<td>
<?php
$woocommerce->cart->calculate_shipping();
$packages = $woocommerce->shipping->get_packages();
foreach ($packages as $i => $package) {
$chosen_method = isset($woocommerce->session->chosen_shipping_methods[$i]) ? $woocommerce->session->chosen_shipping_methods[$i] : '';
$available_methods = $package['rates'];
$show_package_details = sizeof($packages) > 1;
$index = $i;
?>
<?php
if (!empty($available_methods)) {
?>
<?php
if (1 === count($available_methods)) {
$method = current($available_methods);
echo wp_kses_post(wc_cart_totals_shipping_method_label($method));
?>
<input type="hidden" name="shipping_method[<?php
echo esc_attr($index);
?>
]"
data-index="<?php
echo esc_attr($index);
?>
"
id="shipping_method_<?php
echo esc_attr($index);
?>
"
value="<?php
echo esc_attr($method->id);
?>
" class="shipping_method"/>
<?php
} else {
?>
<p style="margin: 0 0 0.5em !important; padding: 0 !important;"><?php
_e('Shipping', 'woocommerce-gateway-klarna');
?>
</p>
<ul id="shipping_method">
<?php
foreach ($available_methods as $method) {
?>
<li>
<input style="margin-left:3px" type="radio"
name="shipping_method[<?php
echo esc_attr($index);
?>
]"
data-index="<?php
echo esc_attr($index);
?>
"
id="shipping_method_<?php
echo esc_attr($index);
//.........这里部分代码省略.........
示例9: hwoo_shipping_method_list
/**
* @param array $data
*/
function hwoo_shipping_method_list()
{
$data = utility_data(func_get_args());
$index = $data['index'];
$chosen_method = $data['chosen_method'];
foreach ($data['available_methods'] as $method) {
?>
<li>
<input type="radio" name="shipping_method[<?php
echo $index;
?>
]" data-index="<?php
echo $index;
?>
" id="shipping_method_<?php
echo $index;
?>
_<?php
echo sanitize_title($method->id);
?>
" value="<?php
echo esc_attr($method->id);
?>
" <?php
checked($method->id, $chosen_method);
?>
class="shipping_method" />
<label for="shipping_method_<?php
echo $index;
?>
_<?php
echo sanitize_title($method->id);
?>
"><?php
echo wp_kses_post(wc_cart_totals_shipping_method_label($method));
?>
</label>
</li>
<?php
}
}