Automattic\WooCommerce\Blocks\Shipping
PickupLocation::calculate_shipping()
Calculate shipping.
Метод класса: PickupLocation{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$PickupLocation = new PickupLocation(); $PickupLocation->calculate_shipping( $package );
- $package(массив)
- Package information.
По умолчанию: array()
Код PickupLocation::calculate_shipping() PickupLocation::calculate shipping WC 9.2.3
public function calculate_shipping( $package = array() ) { if ( $this->pickup_locations ) { foreach ( $this->pickup_locations as $index => $location ) { if ( ! $location['enabled'] ) { continue; } $this->add_rate( array( 'id' => $this->id . ':' . $index, // This is the label shown in shipping rate/method context e.g. London (Local Pickup). 'label' => wp_kses_post( $this->title . ' (' . $location['name'] . ')' ), 'package' => $package, 'cost' => $this->cost, 'meta_data' => array( 'pickup_location' => wp_kses_post( $location['name'] ), 'pickup_address' => $this->has_valid_pickup_location( $location['address'] ) ? wc()->countries->get_formatted_address( $location['address'], ', ' ) : '', 'pickup_details' => wp_kses_post( $location['details'] ), ), ) ); } } }