Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #21238

    How do I get the price field to accept text

    I would like to use this field to post city/location info

    Right now it will only accept numbers

    #111099

    In wp-contentpluginswoocommerceadminpost-typeswritepanelswritepanel-product_data.php replace:

    woocommerce_wp_text_input( array( 'id' => '_regular_price', 'class' => 'wc_input_price short', 'label' => __( 'Regular Price', 'woocommerce' ) . ' ('.get_woocommerce_currency_symbol().')', 'type' => 'number', 'custom_attributes' => array(
    'step' => 'any',
    'min' => '0'
    ) ) );

    with:

    woocommerce_wp_text_input( array( 'id' => '_regular_price', 'class' => 'wc_input_price short', 'label' => __( 'Regular Price', 'woocommerce' ) . ' ('.get_woocommerce_currency_symbol().')', 'type' => 'text', 'custom_attributes' => array(
    'step' => 'any',
    'min' => '0'
    ) ) );

    However probably this won’t work anyway because WooCommerce expects an integer value for the price and it doesn’t make sense to “hijack” this option field.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Woocommerce’ is closed to new replies.