Skip to content

Instantly share code, notes, and snippets.

@plugin-republic
Last active June 17, 2019 15:45
Show Gist options
  • Save plugin-republic/9d93d22abdda67a5330b8fd2ab303022 to your computer and use it in GitHub Desktop.
Save plugin-republic/9d93d22abdda67a5330b8fd2ab303022 to your computer and use it in GitHub Desktop.
<?php
/**
* Add a custom text input field to the product page
*/
function plugin_republic_add_text_field() { ?>
<div class="pr-field-wrap">
<label for="pr-field"><?php _e( 'Your name', 'plugin-republic' ); ?></label>
<input type="text" name='pr-field' id='pr-field' value=''>
</div>
<?php }
add_action( 'woocommerce_before_add_to_cart_button', 'plugin_republic_add_text_field' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment