Untitled
unknown
plain_text
a year ago
477 B
11
Indexable
Never
add_filter( 'pws_add_rate', function ( array $rate, array $package, PWS_Shipping_Method $method ): array { $is_on_backorder = false; foreach ( $package['contents'] as $item ) { /** @var WC_Product $product */ $product = $item['data']; if ( $product->is_on_backorder() ) { $is_on_backorder = true; } } if ( $is_on_backorder ) { $rate['cost'] *= 2; } return $rate; }, 1000, 3 );