woocommerce_shipping_method_add_rate_args filter-hookWC 1.0

Add a shipping rate. If taxes are not set they will be calculated based on cost.

Usage

add_filter( 'woocommerce_shipping_method_add_rate_args', 'wp_kama_woocommerce_shipping_method_add_rate_args_filter', 10, 2 );

/**
 * Function for `woocommerce_shipping_method_add_rate_args` filter-hook.
 * 
 * @param array $args Arguments (default: array()).
 * @param       $that 
 *
 * @return array
 */
function wp_kama_woocommerce_shipping_method_add_rate_args_filter( $args, $that ){

	// filter...
	return $args;
}
$args(array)
Arguments (default: array()).
$that
-

Where the hook is called

WC_Shipping_Method::add_rate()
woocommerce_shipping_method_add_rate_args
woocommerce/includes/abstracts/abstract-wc-shipping-method.php 266-282
$args = apply_filters(
	'woocommerce_shipping_method_add_rate_args',
	wp_parse_args(
		$args,
		array(
			'id'             => $this->get_rate_id(), // ID for the rate. If not passed, this id:instance default will be used.
			'label'          => '', // Label for the rate.
			'cost'           => '0', // Amount or array of costs (per item shipping).
			'taxes'          => '', // Pass taxes, or leave empty to have it calculated for you, or 'false' to disable calculations.
			'calc_tax'       => 'per_order', // Calc tax per_order or per_item. Per item needs an array of costs.
			'meta_data'      => array(), // Array of misc meta data to store along with this rate - key value pairs.
			'package'        => false, // Package array this rate was generated for @since 2.6.0.
			'price_decimals' => wc_get_price_decimals(),
		)
	),
	$this
);

Where the hook is used in WooCommerce

Usage not found.