Skip to content

Instantly share code, notes, and snippets.

View alinakuzmenko15's full-sized avatar

alinakuzmenko15

View GitHub Profile
@moskalukigor
moskalukigor / functions.php
Last active September 14, 2017 08:36
Wordpress Ajax
<?php
/*IS NOT WOOCOMMERCE*/
if ( ! function_exists( 'is_ajax' ) ) {
/**
* is_ajax - Returns true when the page is loaded via ajax.
* @return bool
*/
function is_ajax() {
return defined( 'DOING_AJAX' );
}
@moskalukigor
moskalukigor / Create order programmatically and redirect to payment
Created November 14, 2016 09:56
Create order programmatically and redirect to payment
//AUTHOR: Ronn0 ( stackoverflow.com 31787244 )
if (isset($_POST['isOrder']) && $_POST['isOrder'] == 1) {
$address = array(
'first_name' => $_POST['notes']['domain'],
'last_name' => '',
'company' => $_POST['customer']['company'],
'email' => $_POST['customer']['email'],
'phone' => $_POST['customer']['phone'],
'address_1' => $_POST['customer']['address'],