Posts

Showing posts from February, 2016

Add minimum charge in Woocommerce cart page

// Paste below code in your active themes functions.phpadd_action( 'woocommerce_cart_calculate_fees', 'wc_add_minimum_fee' );function wc_add_minimum_fee(){ global $woocommerce; $stotal = $woocommerce->cart->subtotal; if ($stotal < 999 ) { $surcharge = 100; } else { $surcharge = 0; } $woocommerce->cart->add_fee( __('Surcharge', 'woocommerce'), $surcharge ); }

Login with email or username in codeigniter

function login_user() { $email= $this->input->post('email'); $password= MD5($this->input->post('password')); $this->db->where("(Email='$email' OR Username='$email') AND Password='$password' "); $Query = $this->db->get('users'); if($Query->num_rows() > 0) { return $Query->row(); } else { return false; } }