cart-shipping.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 (the theme developer).
  10. * will need to copy the new files to your theme to maintain compatibility. We try to do this.
  11. * as little as possible, but it does happen. When this occurs the version of the template file will.
  12. * be bumped and the readme will list any important changes.
  13. *
  14. * @see http://docs.woothemes.com/document/template-structure/
  15. * @author WooThemes
  16. * @package WooCommerce/Templates
  17. * @version 3.2.0
  18. */
  19. if ( ! defined( 'ABSPATH' ) ) {
  20. exit;
  21. }
  22. ?>
  23. <tr class="shipping">
  24. <th><?php echo wp_kses_post( $package_name ); ?></th>
  25. <td data-title="<?php echo esc_attr( $package_name ); ?>">
  26. <?php if ( 1 < count( $available_methods ) ) : ?>
  27. <ul id="shipping_method">
  28. <?php foreach ( $available_methods as $method ) : ?>
  29. <li>
  30. <?php
  31. 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 />
  32. <label for="shipping_method_%1$d_%2$s">%5$s</label>',
  33. (int) $index, esc_attr( sanitize_title( $method->id ) ), esc_attr( $method->id ), checked( $method->id, $chosen_method, false ), wp_kses_post( wc_cart_totals_shipping_method_label( $method ) ) );
  34. do_action( 'woocommerce_after_shipping_rate', $method, $index );
  35. ?>
  36. </li>
  37. <?php endforeach; ?>
  38. </ul>
  39. <?php elseif ( 1 === count( $available_methods ) ) : ?>
  40. <?php
  41. $method = current( $available_methods );
  42. 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" />', (int) $index, esc_attr( $method->id ), wp_kses_post( wc_cart_totals_shipping_method_label( $method ) ) );
  43. do_action( 'woocommerce_after_shipping_rate', $method, $index );
  44. ?>
  45. <?php elseif ( WC()->customer->has_calculated_shipping() ) : ?>
  46. <?php echo apply_filters( is_cart() ? 'woocommerce_cart_no_shipping_available_html' : 'woocommerce_no_shipping_available_html', wpautop( esc_html__( 'There are no shipping methods available. Please ensure that your address has been entered correctly, or contact us if you need any help.', 'vamtam-consulting' ) ) ); ?>
  47. <?php elseif ( ! is_cart() ) : ?>
  48. <?php echo wpautop( esc_html__( 'Enter your full address to see shipping costs.', 'vamtam-consulting' ) ); ?>
  49. <?php endif; ?>
  50. <?php if ( $show_package_details ) : ?>
  51. <?php echo '<p class="woocommerce-shipping-contents"><small>' . esc_html( $package_details ) . '</small></p>'; ?>
  52. <?php endif; ?>
  53. </td>
  54. </tr>