• Resolved futureskills

    (@futureskills)


    Hi,

    we are using wocommerce and wordress to sell offline courses

    in each course = product

    we put a
    1. session starting date by advanced custom filed
    2. countdown

    we need to update them automatically for another +5 days

    note: that all products didn’t start at the same day

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ariel

    (@arielhr1987)

    Hi @futureskills

    This plugin helps you to manage cron jobs. The logic behind the cronjob is up to the developers.
    For the scenario you describe, you will need to create the cron job yourself and the logic to set the custom fields and countdown.
    So, in short, this plugin wont help to acomplish that. ??

    Thread Starter futureskills

    (@futureskills)

    thanks for reply, if this plugin will not help me to do this, could you advice alternative solotuion or ideas ?

    Plugin Author Ariel

    (@arielhr1987)

    @futureskills

    You can do it with some code.
    Check this one as a starting point.

    if ( ! wp_next_scheduled( 'update_post_countdown' ) ) {
        wp_schedule_event( time(), 'daily', 'update_post_countdown' );
    }
    
    function update_post_countdown(){
    	$id = 1; //your post id;
    	$metaKey = 'my_countdown_meta'; //your post meta key
    
    	$meta = get_post_meta($id, $metaKey);
    	$time = strtotime($meta);
    
    	if($time && $time < time() ){
    		//update meta countdown to 5 days from now
    		update_post_meta($id, $metaKey, strtotime($meta . ' +5 days')); 
    	}
    
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘could this plugin help me to update product content ?’ is closed to new replies.