Created
October 12, 2018 01:07
-
-
Save luiseduardobraschi/69279730dbca3d553da0a3f7b33228cb to your computer and use it in GitHub Desktop.
Dias a mais para produtos sob encomenda.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('woocommerce_correios_shipping_additional_time', function($additional_time, $package){ | |
$has_outofstock_item = false; | |
foreach( $package['contents'] as $item ) { | |
if ( 'onbackorder' === wc_get_product($item['product_id'])->get_stock_status() ){ | |
$has_outofstock_item = true; | |
break; | |
} | |
} | |
if( $has_outofstock_item ) { | |
$additional_time = 3; // tempo adicional | |
} | |
return $additional_time; | |
}, 10, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment