wc_get_chosen_shipping_method_ids

Gets chosen shipping method IDs from chosen_shipping_methods session, without instance IDs.

Description

(string[]) wc_get_chosen_shipping_method_ids(); 

Returns (string[])


Usage

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

Defined (1)

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

/includes/wc-cart-functions.php  
  1. function wc_get_chosen_shipping_method_ids() { 
  2. $method_ids = array(); 
  3. $chosen_methods = WC()->session->get( 'chosen_shipping_methods', array() ); 
  4. foreach ( $chosen_methods as $chosen_method ) { 
  5. $chosen_method = explode( ':', $chosen_method ); 
  6. $method_ids[] = current( $chosen_method ); 
  7. return $method_ids;