Skip to content

Instantly share code, notes, and snippets.

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

Akeda Bagus gedex

🏠
Working from home
View GitHub Profile
#!/usr/bin/env bash
# Store current directory.
CUR_DIR=$(pwd)
default_old_gh_org="woothemes"
default_new_gh_org="woocommerce"
default_plugins_dir="$CUR_DIR"
echo "Your WP_PLUGIN_DIR. No trailing slash."
diff --git a/gp-includes/things/translation.php b/gp-includes/things/translation.php
index 5beed6a..e90a9b6 100644
--- a/gp-includes/things/translation.php
+++ b/gp-includes/things/translation.php
@@ -491,8 +491,14 @@ class GP_Translation extends GP_Thing {
} else {
$updated = $this->save( array( 'user_id_last_modified' => get_current_user_id(), 'status' => $status ) );
}
+ $old_status = $this->status;
+
@gedex
gedex / woocommerce-woocommerce-gateway-amazon-payments-advanced-rest-api-doc.md
Last active October 30, 2018 15:59
WooCommerce Gateway Amazon Payments Advanced REST API introduced in 1.6.0

WooCommerce Gateway Amazon Payments Advanced REST API

The WooCommerce Gateway Amazon Payments Advanced REST API allows you to authorize, capture, and close authorization. The endpoint is /wp-json/wc/v1/orders/<order_id>/amazon-payments-advanced/.

List of orders paid via Amazon Payments

There's no custom endpoint to retrieve list of orders paid via Amazon Payments. The built-in orders point can be used with _payment_method=amazon_payments_advanced filter.

<?php
if ( ! defined( 'WP_CLI' ) ) {
return;
}
if ( ! WP_CLI ) {
return;
}
<?php
if ( ! defined( 'WP_CLI' ) ) {
return;
}
if ( ! WP_CLI ) {
return;
}
@gedex
gedex / woocommerce-shipment-tracking-rest-api-doc.md
Last active March 21, 2020 09:05
WooCommerce Shipment Tracking REST API introduced in 1.5.0

Shipment Tracking REST API

The shipment tracking REST API allows you to create, view, and delete individual shipment tracking. The endpoint is /wp-json/wc/v1/orders/shipment-trackings.

Shipment Tracking Properties

Attribute Type Description
tracking_id string Unique identifier for shipment tracking read-only
tracking_number string Tracking number required
@gedex
gedex / woocommerce-brands-rest-api-doc.md
Last active June 9, 2018 13:13
Brands REST API in 1.5.0

Brands REST API

The Brands REST API allows you to create, view, update, and delete individual, or a batch, of brands. The endpoint is /wp-json/wc/v1/products/brands which basically mimics /wp-json/wc/v1/products/categories. You can refer to the same documentation of product categories REST API.

In addition to /products/brands endpoints, the /products endpoints also updated to display brands in the response and check the JSON request for brands.

Examples

  • Retrieve all product brands:
1c1
< !function(){function t(e,n){e instanceof t?(this.enc=e.enc,this.pos=e.pos):(this.enc=e,this.pos=n)}function e(t,e,n,i,o){this.stream=t,this.header=e,this.length=n,this.tag=i,this.sub=o}function n(t){var e,n,i="";for(e=0;e+3<=t.length;e+=3)n=parseInt(t.substring(e,e+3),16),i+=et.charAt(n>>6)+et.charAt(63&n);for(e+1==t.length?(n=parseInt(t.substring(e,e+1),16),i+=et.charAt(n<<2)):e+2==t.length&&(n=parseInt(t.substring(e,e+2),16),i+=et.charAt(n>>2)+et.charAt((3&n)<<4));(3&i.length)>0;)i+=nt;return i}function i(t){var e,n,i,o="",r=0;for(e=0;e<t.length&&t.charAt(e)!=nt;++e)i=et.indexOf(t.charAt(e)),0>i||(0==r?(o+=l(i>>2),n=3&i,r=1):1==r?(o+=l(n<<2|i>>4),n=15&i,r=2):2==r?(o+=l(n),o+=l(i>>2),n=3&i,r=3):(o+=l(n<<2|i>>4),o+=l(15&i),r=0));return 1==r&&(o+=l(n<<2)),o}function o(t){var e,n=i(t),o=new Array;for(e=0;2*e<n.length;++e)o[e]=parseInt(n.substring(2*e,2*e+2),16);return o}function r(t,e,n){null!=t&&("number"==typeof t?this.fromNumber(t,e,n):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(
@gedex
gedex / colorized_tail
Last active May 3, 2016 12:13
Colorized PHP logs via tail
coloirzed_tail() {
tail -100f $1 | awk '
/PHP Fatal/ {print "\033[1;31m" $0 "\033[39m"; next}
/WordPress database error/ {print "\033[1;31m" $0 "\033[39m"; next}
/PHP Notice/ {print "\033[1;33m" $0 "\033[39m"; next}
/PHP Warning/ {print "\033[1;33m" $0 "\033[39m"; next}
1 {print}
'
@gedex
gedex / -
Created April 27, 2016 05:23
Archive: trunk/product-packages/woocommerce-subscriptions/woocommerce-subscriptions.zip 1120284 250
drwx--- 0.0 fat 0 bx stor 23-Apr-16 04:55 woocommerce-subscriptions/
drwx--- 0.0 fat 0 bx stor 23-Apr-16 04:55 woocommerce-subscriptions/assets/
drwx--- 0.0 fat 0 bx stor 23-Apr-16 04:55 woocommerce-subscriptions/assets/css/
-rw---- 0.0 fat 4006 tx defN 23-Apr-16 04:55 woocommerce-subscriptions/assets/css/about.css
-rw---- 0.0 fat 20355 tx defN 23-Apr-16 04:55 woocommerce-subscriptions/assets/css/admin.css
-rw---- 0.0 fat 419 tx defN 23-Apr-16 04:55 woocommerce-subscriptions/assets/css/checkout.css
-rw---- 0.0 fat 867 tx defN 23-Apr-16 04:55 woocommerce-subscriptions/assets/css/wcs-upgrade.css
-rw---- 0.0 fat 2193 tx defN 23-Apr-16 04:55 woocommerce-subscriptions/assets/css/woocommerce-subscriptions.css
drwx--- 0.0 fat 0 bx stor 23-Apr-16 04:55 woocommerce-subscriptions/assets/images/