Skip to content

Instantly share code, notes, and snippets.

@asalkey
Created June 7, 2016 01:00
Show Gist options
  • Save asalkey/408eac5ec9ad0292f986f1595280ad79 to your computer and use it in GitHub Desktop.
Save asalkey/408eac5ec9ad0292f986f1595280ad79 to your computer and use it in GitHub Desktop.
add_action( 'woocommerce_add_order_item_meta', array( &$this, 'add_esn_fields'), 10, 3 );
public function add_esn_fields( $item_id, $values, $cart_item_key ) {
if($values['attached_id']){
$x = 1;
while($x <= $values['quantity']) {
wc_add_order_item_meta( $item_id, 'esn', '', false );
$x++;
}
}else if($values['type'] == 'wholesaler') {
$x = 1;
while($x <= $values['quantity']) {
wc_add_order_item_meta( $item_id, 'esn', '', false );
$x++;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment