• Resolved sallam

    (@sallam)


    This is a great plugin.
    I wonder if is possible to add a date picker among the field types available?
    I deliver to my customers one day after the order day. But if its 00:01 customers would think the delivery would be in that day.
    I made a custom field with radio buttons to allow customers to choose a delivery time convenient to them. This is how it looks:

    Delivery time:
    Tomorrow at 3pm
    Tomorrow at 6pm
    Tomorrow at 9pm

    Is there a way or a code that dynamically displays the name of the day instead of the word “Tomorrow” ?
    So that, for example, if its now Sunday, starting at midnight (first minute of Monday) the radio buttons would be:

    Delivery time:
    Tuesday at 3pm
    Tuesday at 6pm
    Tuesday at 9pm

    I appreciate any help or tips please.
    Thanks very much.

    https://wordpress.org/plugins/wc-fields-factory/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Saravana Kumar K

    (@mycholan)

    Hi, Thanks for your review.!

    Yes you can override the way custom fields rendered in product page.

    WC Fields Factory trigger “wccpf/before/fields/rendering” filter before rendering each fields into product page.

    function wccpf_override_label( $field, $html ) {
    
    	if( $field["name"] == "name_on_tshirt" ) {
    		$html = '<div class="your class">
    					<label>Overrided Value</label>
    					<input type="text" name="'.esc_attr( $field["name"] ).'" value="'. esc_attr( $field["default_value"] ) .'" />
    				 </div>';
    	}
    
    	return $html;
    }
    add_filter( 'wccpf/before/fields/rendering', 'wccpf_override_label', 5, 2 );

    To override radio buttons refer PLUGINDIR/wc-fields-factory/classes/fields/radio.php line no 121 to 144.

    If you wanted to override the labels alone refer this article

    I am also planning to release next major version with three more fields type Image, Date Picker and Color Picker

    Happy Blogging.!

    Thread Starter sallam

    (@sallam)

    Thanks for your kind reply.
    Unfortunately, since I don’t know much about coding, I didn’t understand what exactly I should do and where.
    If you could give me simple instructions of specific lines to add or replace in what files, it would be great.

    Plugin Author Saravana Kumar K

    (@mycholan)

    Hi, That hook which I have posted with my previous reply, goes into your Theme’s functions.php, also I already given you the reference for altering radio button behavior.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘date picker?’ is closed to new replies.