Last active
August 22, 2017 23:57
-
-
Save asalkey/d94e19a8b8d62f3755ecb9fd16efdc04 to your computer and use it in GitHub Desktop.
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
<?php | |
add_action( 'woocommerce_add_order_item_meta', 'add_esn_fields'); | |
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