Skip to content

Instantly share code, notes, and snippets.

@luiseduardobraschi
Created October 12, 2018 01:07
Show Gist options
  • Save luiseduardobraschi/69279730dbca3d553da0a3f7b33228cb to your computer and use it in GitHub Desktop.
Save luiseduardobraschi/69279730dbca3d553da0a3f7b33228cb to your computer and use it in GitHub Desktop.
Dias a mais para produtos sob encomenda.
<?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