Skip to content

Instantly share code, notes, and snippets.

View zainaali's full-sized avatar

Zain Ali zainaali

  • Lahore Punjab, Pakistan
View GitHub Profile
// ==UserScript==
// @name Aliexpress
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://trade.aliexpress.com/orderList.htm*
// @grant unsafeWindow
// @grant GM_xmlhttpRequest
// @grant GM_setClipboard
@zainaali
zainaali / add-wc-products-programmatically.php
Created June 18, 2019 15:26 — forked from BKeanu1989/add-wc-products-programmatically.php
adding woocommerce productgs programmatically/ via code
function insert_product ($product_data)
{
$post = array( // Set up the basic post data to insert for our product
'post_author' => 1,
'post_content' => $product_data['description'],
'post_status' => 'publish',
'post_title' => $product_data['name'],
'post_parent' => '',
@zainaali
zainaali / functions.php
Created September 28, 2018 04:36 — forked from musamamasood/functions.php
Method to set order status failed or completed based on Stripe 3D.
add_action( 'wc_gateway_stripe_process_response', 'prefix_wc_gateway_stripe_process_response', 20, 2 );
function prefix_wc_gateway_stripe_process_response( $response, $order ){
if($response->source->type == 'three_d_secure'){
$order->update_status('completed', 'order_note'); ####
//WC_Stripe_Logger::log( 'wc_gateway_stripe_process_response three_d_secure response: ' . print_r( $response->source->type, true ) );
}elseif($response->source->type == 'card'){
$order->update_status('failed', 'order_note'); ####
//WC_Stripe_Logger::log( 'wc_gateway_stripe_process_response card response: ' . print_r( $response->source->type, true ) );
}
}
@zainaali
zainaali / functions.php
Created September 28, 2018 04:35 — forked from musamamasood/functions.php
Shortcode to fetch post by post_type
// create shortcode to list all clothes which come in blue
function statesmen_news_shortcode( $atts ) {
$html = '';
// Attributes
$atts = shortcode_atts(
array(
'post_per_page' => '2',
'post_type' => 'post',
'id' => false
),