wc_cart_totals_shipping_html

Get shipping methods.

Description

wc_cart_totals_shipping_html(); 

Usage

  1. if ( !function_exists( 'wc_cart_totals_shipping_html' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-cart-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wc_cart_totals_shipping_html(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/wc-cart-functions.php  
  1. function wc_cart_totals_shipping_html() { 
  2. $packages = WC()->shipping->get_packages(); 
  3.  
  4. foreach ( $packages as $i => $package ) { 
  5. $chosen_method = isset( WC()->session->chosen_shipping_methods[ $i ] ) ? WC()->session->chosen_shipping_methods[ $i ] : ''; 
  6. $product_names = array(); 
  7.  
  8. if ( sizeof( $packages ) > 1 ) { 
  9. foreach ( $package['contents'] as $item_id => $values ) { 
  10. $product_names[ $item_id ] = $values['data']->get_name() . ' ×' . $values['quantity']; 
  11. $product_names = apply_filters( 'woocommerce_shipping_package_details_array', $product_names, $package ); 
  12.  
  13. wc_get_template( 'cart/cart-shipping.php', array( 
  14. 'package' => $package,  
  15. 'available_methods' => $package['rates'],  
  16. 'show_package_details' => sizeof( $packages ) > 1,  
  17. 'package_details' => implode( ', ', $product_names ),  
  18. // @codingStandardsIgnoreStart 
  19. 'package_name' => apply_filters( 'woocommerce_shipping_package_name', sprintf( _nx( 'Shipping', 'Shipping %d', ( $i + 1 ), 'shipping packages', woocommerce ), ( $i + 1 ) ), $i, $package ),  
  20. // @codingStandardsIgnoreEnd 
  21. 'index' => $i,  
  22. 'chosen_method' => $chosen_method,  
  23. ) );