template
This commit is contained in:
parent
2c26f06e55
commit
8e74d043c1
|
@ -76,11 +76,6 @@ class WC_Cart {
|
|||
* @return void
|
||||
*/
|
||||
function __construct() {
|
||||
|
||||
|
||||
$this->add_fee( 'Gay fee', 10, true );
|
||||
$this->add_fee( 'Another fee', 0.10, true );
|
||||
|
||||
$this->tax = new WC_Tax();
|
||||
$this->prices_include_tax = ( get_option('woocommerce_prices_include_tax') == 'yes' ) ? true : false;
|
||||
$this->display_totals_ex_tax = ( get_option('woocommerce_display_totals_excluding_tax') == 'yes' ) ? true : false;
|
||||
|
|
|
@ -45,77 +45,7 @@ $available_methods = $woocommerce->shipping->get_available_shipping_methods();
|
|||
|
||||
<tr class="shipping">
|
||||
<th colspan="2"><?php _e( 'Shipping', 'woocommerce' ); ?></th>
|
||||
<td>
|
||||
<?php
|
||||
// If at least one shipping method is available
|
||||
if ( $available_methods ) {
|
||||
|
||||
// Prepare text labels with price for each shipping method
|
||||
foreach ( $available_methods as $method ) {
|
||||
$method->full_label = esc_html( $method->label );
|
||||
|
||||
if ( $method->cost > 0 ) {
|
||||
$method->full_label .= ': ';
|
||||
|
||||
// Append price to label using the correct tax settings
|
||||
if ( $woocommerce->cart->display_totals_ex_tax || ! $woocommerce->cart->prices_include_tax ) {
|
||||
$method->full_label .= woocommerce_price( $method->cost );
|
||||
if ( $method->get_shipping_tax() > 0 && $woocommerce->cart->prices_include_tax ) {
|
||||
$method->full_label .= ' '.$woocommerce->countries->ex_tax_or_vat();
|
||||
}
|
||||
} else {
|
||||
$method->full_label .= woocommerce_price( $method->cost + $method->get_shipping_tax() );
|
||||
if ( $method->get_shipping_tax() > 0 && ! $woocommerce->cart->prices_include_tax ) {
|
||||
$method->full_label .= ' '.$woocommerce->countries->inc_tax_or_vat();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Print a single available shipping method as plain text
|
||||
if ( 1 === count( $available_methods ) ) {
|
||||
|
||||
echo $method->full_label;
|
||||
echo '<input type="hidden" name="shipping_method" id="shipping_method" value="'.esc_attr( $method->id ).'">';
|
||||
|
||||
// Show multiple shipping methods
|
||||
} else {
|
||||
|
||||
if ( get_option('woocommerce_shipping_method_format') == 'select' ) {
|
||||
|
||||
echo '<select name="shipping_method" id="shipping_method">';
|
||||
|
||||
foreach ( $available_methods as $method )
|
||||
echo '<option value="' . esc_attr( $method->id ) . '" ' . selected( $method->id, $woocommerce->session->chosen_shipping_method, false ) . '>' . strip_tags( $method->full_label ) . '</option>';
|
||||
|
||||
echo '</select>';
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
echo '<ul id="shipping_method">';
|
||||
|
||||
foreach ( $available_methods as $method )
|
||||
echo '<li><input type="radio" name="shipping_method" id="shipping_method_' . sanitize_title( $method->id ) . '" value="' . esc_attr( $method->id ) . '" ' . checked( $method->id, $woocommerce->session->chosen_shipping_method, false ) . ' /> <label for="shipping_method_' . sanitize_title( $method->id ) . '">' . $method->full_label . '</label></li>';
|
||||
|
||||
echo '</ul>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// No shipping methods are available
|
||||
} else {
|
||||
|
||||
if ( ! $woocommerce->customer->get_shipping_country() || ! $woocommerce->customer->get_shipping_state() || ! $woocommerce->customer->get_shipping_postcode() ) {
|
||||
echo '<p>'.__( 'Please fill in your details above to see available shipping methods.', 'woocommerce' ).'</p>';
|
||||
} else {
|
||||
echo '<p>'.__( '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>';
|
||||
}
|
||||
|
||||
}
|
||||
?></td>
|
||||
|
||||
<td><?php woocommerce_get_template( 'cart/shipping-methods.php', array( 'available_methods' => $available_methods ) ); ?></td>
|
||||
</tr>
|
||||
|
||||
<?php do_action('woocommerce_review_order_after_shipping'); ?>
|
||||
|
|
Loading…
Reference in New Issue