Stay on top with regular WordPress updates.
Subscribe to our newsletter(s) and get the latest stories in your mailbox!
Stay on top with regular WordPress updates.
Subscribe to our newsletter(s) and get the latest stories in your mailbox!
This code adds a custom field to the single product edit screen enabling the storeowner to add a completion date for each product.
The date shows on the single product page.
Add the code to the end of your child themes functions file or custom code snippets plugin.
add_action( ‘woocommerce_product_options_general_product_data’, ‘add_lead_time_field’ ); function add_lead_time_field() { woocommerce_wp_text_input( array( ‘id’ => ‘_lead_time_days’, ‘label’ => ‘Lead Time (Days)’, ‘placeholder’ => ‘Number of days to complete’, ‘type’ => ‘number’, ‘custom_attributes’ => array( ‘min’ => ‘1’, ‘step’ => ‘1’, ), )); } add_action( ‘woocommerce_admin_process_product_object’, ‘save_lead_time_field’ ); function save_lead_time_field( $product ) { if ( isset( $_POST[‘_lead_time_days’] ) )
This is the first part of the article