Skip to content

Instantly share code, notes, and snippets.

@corsonr
corsonr / available_fields.php
Last active October 4, 2022 11:24
WooCommerce Stripe: add custom meta data to send to stripe
<?php
$order->get_data(); (not needed is using the code above)
$order_id = $order_data['id'];
$order_parent_id = $order_data['parent_id'];
$order_status = $order_data['status'];
$order_currency = $order_data['currency'];
$order_version = $order_data['version'];
$order_payment_method = $order_data['payment_method'];
$order_payment_method_title = $order_data['payment_method_title'];
@corsonr
corsonr / humanity.user.js
Created January 30, 2018 08:42
Humanity / Tamper monkey: disable slots when you're not available
// ==UserScript==
// @name Hide Humanity slots when not available
// @namespace https://automattic2.humanity.com
// @version 0.1
// @description Hide Humanity slots when not available
// @author @remicorson
// @grant none
// @match https://automattic2.humanity.com/app/requests/*
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==
@corsonr
corsonr / index.html
Created January 3, 2018 12:36
Basic grid layout
<html>
<header>
<link rel='stylesheet' id='style-css' href='style.css' type='text/css' media='all' />
</header>
<body>
<section id="page">
<header>Header</header>
<section id="intro">Intro</section>
<main>Main section</main>
@corsonr
corsonr / functions.php
Created December 22, 2017 08:17
WooCommerce: disable payments on checkout page
<?php // Do not include this if already open! Code goes in theme functions.php.
// Disable all payment gateways on the checkout page and replace the "Pay" button by "Place order"
add_filter( 'woocommerce_cart_needs_payment', '__return_false' );
@corsonr
corsonr / functions.php
Created December 18, 2017 11:12
WooCommerce: replace "tax" in "includes $xx.xx Tax" on the cart page
<?php // Do not include this if already open! Code goes in theme functions.php.
/**
* woocommerce_cart_totals_order_total_html
*
* @access public
* @since 1.0
* @return void
*/
add_filter( 'woocommerce_cart_totals_order_total_html', 'woo_rename_tax_inc_cart', 10, 1 );
@corsonr
corsonr / functions.php
Last active February 4, 2019 21:48
WooCommerce custom emails header
<?php // Do not include this if already open! Code goes in theme functions.php.
add_filter( 'woocommerce_email_headers', 'woo_update_emails_header', 10, 2);
function woo_update_emails_header( $headers, $object ) {
$headers = array();
$headers[] = 'Content-Type: text/html; charset=UTF-8'; // update the encoding/charset here
return $headers;
}
@corsonr
corsonr / functions.php
Created December 5, 2017 08:37
WooCommerce: modify WooCommerce default customer role
<?php // Do not include this if already open! Code goes in theme functions.php.
/**
* woocommerce_custom_new_customer_data
*
* @access public
* @since 1.0
* @return void
*/
function woocommerce_custom_new_customer_data( $new_customer_data ) {
@corsonr
corsonr / functions.php
Created November 6, 2017 07:58
Woo: force user role after order is placed
<?php // Do not include this if already open! Code goes in theme functions.php.
function woo_force_update_user_role( $order_id ) {
$order = new WC_Order( $order_id );
if ( $order->user_id > 0 ) {
$user = new WP_User( $order->user_id );
@corsonr
corsonr / stripe.php
Created October 16, 2017 07:20
WooCommerce: version check support complete
<?php
/*
* Plugin Name: WooCommerce Stripe Gateway
* Plugin URI: https://wordpress.org/plugins/woocommerce-gateway-stripe/
* Description: Take credit card payments on your store using Stripe.
* Author: WooCommerce
* Author URI: https://woocommerce.com/
* Version: 3.2.3
* Requires at least: 4.4
* Tested up to: 4.8
@corsonr
corsonr / stripe.php
Last active October 4, 2022 11:30
WooCommerce: version support check
* WC requires at least: 3.0.0
* WC tested up to: 3.2.0