This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add fields to new vendor form | |
add_action( 'shop_vendor_add_form_fields', 'custom_add_vendor_fields', 2, 1 ); | |
function custom_add_vendor_fields( $taxonomy ) { | |
?> | |
<div class="form-field"> | |
<label for="vendor_website"><?php _e( 'Vendor website' ); ?></label> | |
<input type="text" name="vendor_data[website]" id="vendor_website" class="vendor_fields" /><br/> | |
<span class="description"><?php _e( 'The vendor\'s website.' ); ?></span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Register term fields | |
*/ | |
add_action( 'init', 'register_vendor_custom_fields' ); | |
function register_vendor_custom_fields() { | |
add_action( WC_PRODUCT_VENDORS_TAXONOMY . '_add_form_fields', 'add_vendor_custom_fields' ); | |
add_action( WC_PRODUCT_VENDORS_TAXONOMY . '_edit_form_fields', 'edit_vendor_custom_fields', 10 ); | |
add_action( 'edited_' . WC_PRODUCT_VENDORS_TAXONOMY, 'save_vendor_custom_fields' ); | |
add_action( 'created_' . WC_PRODUCT_VENDORS_TAXONOMY, 'save_vendor_custom_fields' ); | |
} |