Skip to content

Commit

Permalink
Merge pull request #2052 from matt-h/filter-shipping
Browse files Browse the repository at this point in the history
Add filter to be able to build custom shipping method rate handers.
  • Loading branch information
puntope authored Nov 16, 2023
2 parents 5c7fa5e + 5005c0c commit 7264052
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Shipping/ZoneMethodsParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,17 @@ protected function shipping_method_to_rates( object $method ): array {
$shipping_rates[] = $shipping_rate;
break;
default:
// We don't support other shipping methods.
return [];
/**
* Filter the shipping rates for a shipping method that is not supported.
*
* @param ShippingRate[] $shipping_rates The shipping rates.
* @param object|WC_Shipping_Method $method The shipping method.
*/
return apply_filters(
'woocommerce_gla_handle_shipping_method_to_rates',
$shipping_rates,
$method
);
}

return $shipping_rates;
Expand Down

0 comments on commit 7264052

Please sign in to comment.