Last active
May 27, 2016 01:52
-
-
Save alexphelps/c388dc191f7f44fdaf538575ac1d8591 to your computer and use it in GitHub Desktop.
WooCommerce UPS Shipping Default Product Weight
This file contains hidden or 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
add_filter( 'woocommerce_shipping_init', 'set_default_product_weight', 1 ); | |
function set_default_product_weight( ) { | |
if ( ! is_admin() ) { | |
foreach ( WC()->cart->get_cart() as $item_id => $values ) { | |
$_product = $values['data']; | |
if ( empty( $_product->weight ) ) { | |
$_product->weight = 1.00; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment