Skip to content

Instantly share code, notes, and snippets.

View kilbot's full-sized avatar

Paul Kilmurray kilbot

View GitHub Profile
@kilbot
kilbot / gist:cd978bc863ee1968c4b8
Last active August 29, 2015 14:14
Add to the theme functions.php file
function log_new_orders() {
error_reporting(0);
$log = new WC_Logger();
$log->add('woocommerce-pos', print_r(debug_backtrace(), true));
}
add_action( 'save_post_shop_order', 'log_new_orders' );
@kilbot
kilbot / gist:1629c80ff1443dc5e7fa
Created February 1, 2015 11:33
Add to the theme functions.php
function log_all_emails($mail) {
error_reporting(0);
$log = new WC_Logger();
$log->add('woocommerce-pos', print_r($mail, true));
return $mail;
}
add_filter( 'wp_mail', 'log_all_emails' );
{
"product": {
"title": "Glasschale \"Grosse Welle\"",
"id": 4116,
"created_at": "2012-04-09T20:29:31Z",
"updated_at": "2015-03-14T10:26:32Z",
"type": "variable",
"status": "publish",
"downloadable": false,
"virtual": false,
{
"product": {
"title": "L\u00f6we aus recycelten Flip Flops",
"id": 12250,
"created_at": "2015-05-04T20:50:38Z",
"updated_at": "2015-05-06T10:48:46Z",
"type": "variable",
"status": "publish",
"downloadable": false,
"virtual": false,
{
"product": {
"title": "Y-Ply",
"id": 7480,
"created_at": "2013-03-09T14:35:36Z",
"updated_at": "2014-06-26T21:31:51Z",
"type": "variable",
"status": "publish",
"downloadable": false,
"virtual": false,
@kilbot
kilbot / wp-tests-config.php
Created June 14, 2015 16:44
wp-tests-config.php
<?php
/* Path to the WordPress codebase you'd like to test. Add a backslash in the end. */
define( 'ABSPATH', '/srv/www/woopos/htdocs/' );
// Test with multisite enabled.
// Alternatively, use the tests/phpunit/multisite.xml configuration file.
// define( 'WP_TESTS_MULTISITE', true );
// Force known bugs to be run.
@kilbot
kilbot / travis-ci-apache
Created June 14, 2015 23:30
travis-ci-apache
<VirtualHost *:80>
DocumentRoot %TRAVIS_BUILD_DIR%
<Directory "%TRAVIS_BUILD_DIR%">
Options FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order deny,allow
Allow from all
</Directory>
@kilbot
kilbot / 22.json
Created June 25, 2015 14:17
WC Variable product
{
"product": {
"title": "Ship Your Idea",
"id": 22,
"created_at": "2013-06-07T10:46:01Z",
"updated_at": "2015-06-25T06:48:13Z",
"type": "variable",
"status": "publish",
"downloadable": false,
"virtual": false,
@kilbot
kilbot / order.json
Last active August 29, 2015 14:24
Example Order from WC REST API
{
"order": {
"id": 645,
"order_number": 645,
"created_at": "2015-01-26T20:00:21Z",
"updated_at": "2015-01-26T20:00:21Z",
"completed_at": "2015-01-26T20:00:21Z",
"status": "completed",
"currency": "USD",
"total": "79.87",
@kilbot
kilbot / functions.php
Last active October 8, 2015 05:23
Hook to access product meta on order creation
function custom_order_item_meta_hook( $meta_id, $order_item_id, $meta_key, $meta_value ){
if( $meta_key == 'Delivery Date' ){
// Do something
}
}
add_action( 'added_order_item_meta', 'custom_order_item_meta_hook', 10, 4 );