I want to add some extra field in the cart page. i mean when a user add some product into cart and pressed view cart
button then he can see his selected product with some default field image product price and total but I want add extra field where user can choose an option to get product monthly or weekly. So I want to add an option drop down for each product in the cart page.I saw some plugin but all are working on checkout pages not cart page. So how can I add extra field into the cart page.
I want to add some extra field in the cart page. i mean when a user add some product into cart and pressed view cart
button then he can see his selected product with some default field image product price and total but I want add extra field where user can choose an option to get product monthly or weekly. So I want to add an option drop down for each product in the cart page.I saw some plugin but all are working on checkout pages not cart page. So how can I add extra field into the cart page.
1 Answer
Reset to default 0use this function and edit cart page template
/**
* Display engraving text in the cart.
*
* @param array $item_data
* @param array $cart_item
*
* @return array
*/
function iconic_display_engraving_text_cart( $item_data, $cart_item ) {
if ( empty( $cart_item['iconic-engraving'] ) ) {
return $item_data;
}
$item_data[] = array(
'key' => __( 'Engraving', 'iconic' ),
'value' => wc_clean( $cart_item['iconic-engraving'] ),
'display' => '',
);
return $item_data;
}
add_filter( 'woocommerce_get_item_data', 'iconic_display_engraving_text_cart', 10, 2 );