Support » Plugin: WC Fields Factory » "Order Again" not transferring custom fields

  • I have a simple custom text field (Name on Shirt), plus some variations for size and colour. When I click “Order again” the size and colour transfer, but the “Name on Shirt” does not appear under the cart item when viewing VIEW CART. Is there a way to add this? I attempted to play with the woocommerce_order_again_cart_item_data filter but wasn’t able to solve the issue.

    Thank you.

Viewing 1 replies (of 1 total)
  • Here’s some code I have that is not working – hopefully someone can let me know what I need to adjust to get it working:

    add_filter( 'woocommerce_order_again_cart_item_data', 'tres_add_shirt_text_to_order_again', 10, 3 );
    function tres_add_shirt_text_to_order_again($cart_item_data, $item, $order) {
    	global $woocommerce;
    	// I saw this next line in some similar code on the web, but I'm not sure if it is necessary?
    	remove_filter( 'woocommerce_add_to_cart_validation', array( $woocommerce, 'validate_add_cart_item' ), 10, 3 );
    	$key = 'Shirt Text';
    	if ( ! array_key_exists( 'item_meta', $cart_item_data ) || ! is_array( $cart_item_data['item_meta'] ) ) {
            $cart_item_data['item_meta'] = array();
    	$cart_item_data['shirt_text'] = $product['item_meta'][$key][0];
    	$cart_item_data['item_meta']['shirt_text'] = $product['item_meta'][$key][0];
    	return $cart_item_data;
Viewing 1 replies (of 1 total)
  • The topic ‘"Order Again" not transferring custom fields’ is closed to new replies.