Advertisement
Guest User

Untitled

a guest
Jun 7th, 2016
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.80 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Shipping Methods Display
  4.  *
  5.  * In 2.1 we show methods per package. This allows for multiple methods per order if so desired.
  6.  *
  7.  * This template can be overridden by copying it to yourtheme/woocommerce/cart/cart-shipping.php.
  8.  *
  9.  * HOWEVER, on occasion WooCommerce will need to update template files and you
  10.  * (the theme developer) will need to copy the new files to your theme to
  11.  * maintain compatibility. We try to do this as little as possible, but it does
  12.  * happen. When this occurs the version of the template file will be bumped and
  13.  * the readme will list any important changes.
  14.  *
  15.  * @see         https://docs.woothemes.com/document/template-structure/
  16.  * @author      WooThemes
  17.  * @package     WooCommerce/Templates
  18.  * @version     2.5.0
  19.  */
  20. if ( ! defined( 'ABSPATH' ) ) {
  21.     exit;
  22. }
  23. ?>
  24. <tr class="shipping">
  25.     <th><?php echo wp_kses_post( $package_name ); ?></th>
  26.     <td data-title="<?php echo esc_attr( $package_name ); ?>">
  27.         <?php if ( 1 < count( $available_methods ) ) : ?>
  28.             <ul id="shipping_method">
  29.                 <?php foreach ( $available_methods as $method ) : ?>
  30.                     <li>
  31.                         <?php
  32.                             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 />
  33.                                 <label for="shipping_method_%1$d_%2$s">%5$s</label>',
  34.                                 $index, sanitize_title( $method->id ), esc_attr( $method->id ), '', wc_cart_totals_shipping_method_label( $method ) );
  35.  
  36.                             do_action( 'woocommerce_after_shipping_rate', $method, $index );
  37.                         ?>
  38.                     </li>
  39.                 <?php endforeach; ?>
  40.             </ul>
  41.         <?php elseif ( 1 === count( $available_methods ) ) :  ?>
  42.             <?php
  43.                 $method = current( $available_methods );
  44.                 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 ) );
  45.                 do_action( 'woocommerce_after_shipping_rate', $method, $index );
  46.             ?>
  47.         <?php elseif ( ! WC()->customer->has_calculated_shipping() ) : ?>
  48.             <?php echo wpautop( __( 'Shipping costs will be calculated once you have provided your address.', 'woocommerce' ) ); ?>
  49.         <?php else : ?>
  50.             <?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' ) ) ); ?>
  51.         <?php endif; ?>
  52.  
  53.         <?php if ( $show_package_details ) : ?>
  54.             <?php echo '<p class="woocommerce-shipping-contents"><small>' . esc_html( $package_details ) . '</small></p>'; ?>
  55.         <?php endif; ?>
  56.  
  57.         <?php if ( is_cart() && ! $index ) : ?>
  58.             <?php woocommerce_shipping_calculator(); ?>
  59.         <?php endif; ?>
  60.     </td>
  61. </tr>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement