Skip to content

Instantly share code, notes, and snippets.

View balakrishnandsr's full-sized avatar
🏠
Working from home

Balakrishnan balakrishnandsr

🏠
Working from home
View GitHub Profile
@balakrishnandsr
balakrishnandsr / simple-admin-page.php
Created October 11, 2021 07:07 — forked from stephenh1988/simple-admin-page.php
A simple class based on a tutorial at WP.Tuts that creates an page with metaboxes.
<?php
/*
Description: A simple class based on a tutorial at WP.Tuts that creates an page with metaboxes.
Author: Stephen Harris
Author URI: http://www.stephenharris.info
*/
/* Copyright 2011 Stephen Harris ([email protected])
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@balakrishnandsr
balakrishnandsr / woocommerce_order_status_changed.php
Created August 12, 2021 13:18
woocommerce_order_status_changed
public function update_store_credit_on_the_order_status_complete($order_id, $previous_status, $next_status, $order){
if($next_status == 'completed'){
$from = strtotime($order->get_date_created());
$to = strtotime($order->get_date_modified());
$time_diff = human_time_diff( $from, $to );
$time_diff = explode(" ",$time_diff);
if(isset($time_diff[0]) && isset($time_diff[1]) && ($time_diff[0] < 5) ){