Implemented packages filter for marketplace

This commit is contained in:
Thiago Benvenuto 2016-03-03 22:26:59 -03:00
parent defa1f9fb9
commit 7832039bb7
1 changed files with 11 additions and 1 deletions

View File

@ -237,9 +237,19 @@ class WC_Shipping {
return;
}
// Allow packages to be reorganized before calculate the shipping
$packages = apply_filters( 'woocommerce_shipping_packages_before_calculate', $packages );
// Calculate costs for passed packages
foreach ( $packages as $package_key => $package ) {
$this->packages[ $package_key ] = $this->calculate_shipping_for_package( $package );
$this->packages[ $package_key ] = $this->calculate_shipping_for_package( $package );
}
// Allow packages to be reorganized after calculate the shipping
$this->packages = apply_filters( 'woocommerce_shipping_packages_after_calculate', $this->packages );
if ( ! is_array( $this->packages ) || empty( $this->packages ) ) {
return;
}
// Get all chosen methods