Skip to content

Instantly share code, notes, and snippets.

View corsonr's full-sized avatar

Remi Corson corsonr

View GitHub Profile
@corsonr
corsonr / functions.php
Created July 24, 2018 07:34
WooCommerce 360: slow down...
<?php // Do not include this if already open! Code goes in theme functions.php.
/*
* Slow down WooCommerce 360 images rotation.
*/
add_filter( 'wc360_js_playspeed', 'woo_slow_down360' );
function woo_slow_down360( $speed ) {
return 50;
}
@corsonr
corsonr / functions.php
Created July 13, 2018 09:06
WooCommerce: Add conditional checkout fields based on products in cart
<?php // Do not include this if already open! Code goes in theme functions.php.
/**
* Add fields to the checkout page based on products in cart.
*
* @how-to https://remicorson.com/?p=7871
* @author Remi Corson
* @testedwith WooCommerce 3.4.0
*/
@corsonr
corsonr / functions.php
Created June 29, 2018 08:17
WooCommerce Stripe: force customer creation in Stripe
<?php // Do not include this if already open! Code goes in theme functions.php.
/*
* Force customer creation process in Stripe.
*/
add_filter( 'wc_stripe_force_save_source', '__return_true' );
@corsonr
corsonr / oncefiller.user.js
Last active March 29, 2019 07:58
A8C - Once key field auto-filler
// ==UserScript==
// @name A8C - Once key field auto-filler
// @namespace http://automattic.com/
// @version 0.1
// @description Pre-fill Once fields
// @author Remi Corson
// @match https://<place_mc_url_here>/once/*
// @require http://code.jquery.com/jquery-latest.js
// @grant none
// ==/UserScript==
@corsonr
corsonr / README.md
Last active September 25, 2022 09:11
WooCommerce: remove products ordering dropdown select in shop page

Remove default ordering on WooCommerce Shop page

This snippet gives the ability to remove the default product sortering dropdown select on the shop page. You can place the code in functions.php.

@corsonr
corsonr / functions.php
Created April 9, 2018 12:42
WooCommerce: checkout page hook sample
<?php
add_filter( 'woocommerce_review_order_before_payment', 'add_my_checkout_section' );
function add_my_checkout_section() {
wc_print_notice( apply_filters( 'woocommerce_checkout_my_checkout_section', __( 'Want a phone call before you buy?', 'woocommerce' ) . ' <a href="#">' . __( 'Click here, we call you back!', 'woocommerce' ) . '</a>' ), 'notice' );
}
@corsonr
corsonr / functions.php
Last active July 4, 2023 08:14
Loop through WooCommerce order products
<?php
$count = 1;
foreach( $order->get_items() as $item_id => $line_item ){
$item_data = $line_item->get_data();
$product = $line_item->get_product();
$product_name = $product->get_name();
$item_quantity = $line_item->get_quantity();
$item_total = $line_item->get_total();
$metadata['Line Item '.$count] = 'Product name: '.$product_name.' | Quantity: '.$item_quantity.' | Item total: '. number_format( $item_total, 2 );
@corsonr
corsonr / functions.php
Created April 3, 2018 11:36
Get WooCommerce order details
<?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 / 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==