WC_Shipping_Legacy_International_Delivery

International Delivery - Based on the Flat Rate Shipping Method.

Defined (1)

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

/includes/shipping/legacy-international-delivery/class-wc-shipping-legacy-international-delivery.php  
  1. class WC_Shipping_Legacy_International_Delivery extends WC_Shipping_Legacy_Flat_Rate { 
  2.  
  3. /** 
  4. * Constructor. 
  5. */ 
  6. public function __construct() { 
  7. $this->id = 'legacy_international_delivery'; 
  8. $this->method_title = __( 'International flat rate (legacy)', 'woocommerce' ); 
  9. $this->method_description = '<strong>' . sprintf( __( 'This method is deprecated in 2.6.0 and will be removed in future versions - we recommend disabling it and instead setting up a new rate within your <a href="%s">Shipping zones</a>.', 'woocommerce' ), admin_url( 'admin.php?page=wc-settings&tab=shipping' ) ) . '</strong>'; 
  10. $this->init(); 
  11.  
  12. add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) ); 
  13.  
  14. /** 
  15. * Return the name of the option in the WP DB. 
  16. * @since 2.6.0 
  17. * @return string 
  18. */ 
  19. public function get_option_key() { 
  20. return $this->plugin_id . 'international_delivery' . '_settings'; 
  21.  
  22. /** 
  23. * Initialise settings form fields. 
  24. */ 
  25. public function init_form_fields() { 
  26. parent::init_form_fields(); 
  27. $this->form_fields['availability'] = array( 
  28. 'title' => __( 'Availability', 'woocommerce' ),  
  29. 'type' => 'select',  
  30. 'class' => 'wc-enhanced-select',  
  31. 'description' => '',  
  32. 'default' => 'including',  
  33. 'options' => array( 
  34. 'including' => __( 'Selected countries', 'woocommerce' ),  
  35. 'excluding' => __( 'Excluding selected countries', 'woocommerce' ),  
  36. ),  
  37. ); 
  38.  
  39. /** 
  40. * is_available function. 
  41. * @param array $package 
  42. * @return bool 
  43. */ 
  44. public function is_available( $package ) { 
  45. if ( "no" === $this->enabled ) { 
  46. return false; 
  47. if ( 'including' === $this->availability ) { 
  48. if ( is_array( $this->countries ) && ! in_array( $package['destination']['country'], $this->countries ) ) { 
  49. return false; 
  50. } else { 
  51. if ( is_array( $this->countries ) && ( in_array( $package['destination']['country'], $this->countries ) || ! $package['destination']['country'] ) ) { 
  52. return false; 
  53. return apply_filters( 'woocommerce_shipping_' . $this->id . '_is_available', true, $package );