// Save to cart item data add_filter('woocommerce_add_cart_item_data', 'mms_add_custom_cart_item_data', 10, 2); function mms_add_custom_cart_item_data($cart_item_data, $product_id) { if (isset($_POST['mobile_brand']) && isset($_POST['mobile_model'])) { $cart_item_data['mobile_brand'] = sanitize_text_field($_POST['mobile_brand']); $cart_item_data['mobile_model'] = sanitize_text_field($_POST['mobile_model']); } return $cart_item_data; } // Show in cart & checkout add_filter('woocommerce_get_item_data', 'mms_display_cart_item_data', 10, 2); function mms_display_cart_item_data($item_data, $cart_item) { if (!empty($cart_item['mobile_brand'])) { $item_data[] = [ 'key' => 'Select Your Brand', 'value' => wc_clean($cart_item['mobile_brand']) ]; } if (!empty($cart_item['mobile_model'])) { $item_data[] = [ 'key' => 'Select Your Model', 'value' => wc_clean($cart_item['mobile_model']) ]; } return $item_data; } Cart - Gizmobitz

Cart

Cart is emptyYour cart is currently empty.

Return to shop

Close
Close
Sign in
Close
Cart (0)

No products in the cart. No products in the cart.