Untitled
unknown
plain_text
2 years ago
555 B
5
Indexable
add_filter( 'pws_has_free_shipping', 'nabik_pws_has_free_shipping', 10, 3 );
function nabik_pws_has_free_shipping( bool $has_free_shipping, array $package, PWS_Shipping_Method $method ): bool {
foreach ( PWS_Cart::get_shipping_items() as $cart_item ) {
/** @var WC_Product $product */
$product = $cart_item['data'];
if ( $product->is_on_sale() ) {
return false;
}
}
if ( count( $package['applied_coupons'] ) ) {
return false;
}
return $has_free_shipping;
}Editor is loading...
Leave a Comment