WooCommerce - excelling eCommerce
Input Field on Checkout Product Specific (1 post)

  1. Kiseki Studio
    Posted 2 years ago #

    Hi all,

    I've had a quick search of the forum but I can't seem to find anything relating to my issue. I hope it's a relatively simple fix as I think I'm close to getting it to work.

    I've added an additional input field to the checkout page which is required, this is working fine. However I only want this field to show up when a specific product is being purchased.

    My code looks like this at the moment

    add_action('woocommerce_after_order_notes', 'my_custom_checkout_field');

    function my_custom_checkout_field( $checkout ) {

    if (is_checkout() {

    echo '<div id="pc-id"><h2>'.__('Please enter the PC ID:').'</h2>';

    woocommerce_form_field( 'pc-id', array(
    'type' => 'text',
    'class' => array('my-field-class form-row-wide'),
    'label' => __('(Open the Mill Wizard on the computer you want to run the program, go to Help > About)'),
    'placeholder' => __('Please enter the PC ID:'),
    ), $checkout->get_value( 'my_field_name' ));

    echo '</div>';

    } else {
    echo 'Testing';


    I tried the conditional tag is_product_tag('mill-wizard') but this didn't seem to work. As you may have gathered I'm no expert in php, hopefully one of you dudes can help me out.

    Many thanks in advance.


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic