$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>woocommerce offtopic - How to customize product at cart page|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

woocommerce offtopic - How to customize product at cart page

matteradmin7PV0评论

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.

Share Improve this question edited Nov 15, 2018 at 16:22 fuxia 107k39 gold badges255 silver badges461 bronze badges asked Nov 15, 2018 at 12:00 Md. Abu ZamanMd. Abu Zaman 1251 silver badge4 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

use 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 );
Post a comment

comment list (0)

  1. No comments so far