Skip to content

Instantly share code, notes, and snippets.

Google Apps Script Spreadsheet Utilities and Custom Functions#

These utilities are grouped into related files, for simpler copy & paste to your scripts.

ConvertA1.gs

A couple of helper functions to convert to & from A1 notation.

cellA1ToIndex( string cellA1, number index )

<?php
/**
* Plugin Name: WooCommerce Settings Tab Demo
* Plugin URI: https://gist.github.com/BFTrick/b5e3afa6f4f83ba2e54a
* Description: A plugin demonstrating how to add a WooCommerce settings tab.
* Author: Patrick Rauland
* Author URI: http://speakinginbytes.com/
* Version: 1.0
*
* This program is free software: you can redistribute it and/or modify
@fikrirasyid
fikrirasyid / gist:10739e0241bfffeeaa91
Created September 2, 2014 00:10
WordPress: Use Custom Template From Plugins
/**
* Route single page to custom template
*
* @return string of path
*/
function fr_route_template( $single_template ){
// Put any conditional tag here. This one assumes you want to serve custom template for CPT titled "newsletter"'s single page
if( is_singular( 'newsletter' ) ){
@amitabhaghosh197
amitabhaghosh197 / woocommerce-add-custom-field.php
Last active September 9, 2017 18:56
woocommerce-codes #wordpress #woocommerce #important
// [Ref:][http://www.remicorson.com/mastering-woocommerce-products-custom-fields/]
/*===================================================================
== FUNCTIONS FOR FREE PRODUCT & TOTAL PRODUCT
====================================================================*/
/****************CUSTOM FIELD FOR CUSTOM GENERAL FIELD**************************************************/
// Add Free Number Custom Field in Woocommerce
//Display Field
@mircobabini
mircobabini / woocommerce-edits.php
Last active July 30, 2019 19:50
woocommerce useful actions
<?php
/**
* @author Mirco Babini, SED Web Italia
*
* Contents:
* - reset payment method on 'add to cart'
* - add message to (customer) email per payment method
* - add payment method to email
* - remove product tabs
* - remove result count and default ordering (doesnt work?)
@ejntaylor
ejntaylor / functions.php
Created September 17, 2014 15:12
WooCommerce Shipping Calculated after Coupon
<?php
// WooCommerce Shipping Calculated after Coupon
add_filter( 'woocommerce_shipping_free_shipping_is_available', 'filter_shipping', 10, 2 );
function filter_shipping( $is_available, $package ) {
if ( WC()->cart->prices_include_tax )
$total = WC()->cart->cart_contents_total + array_sum( WC()->cart->taxes );
else
@SirDarcanos
SirDarcanos / jquery.wc-custom.js
Last active April 27, 2021 05:05
woocommerce ajax load billing address
jQuery(document).ready(function ( $ ) {
$( 'button.load_customer_billing' ).off( 'click' );
$( 'button.load_customer_billing' ).on( 'click', function() {
if ( window.confirm( woocommerce_admin_meta_boxes.load_billing ) ) {
// Get user ID to load data for
var user_id = $( '#customer_user' ).val();
if ( ! user_id ) {
window.alert( woocommerce_admin_meta_boxes.no_customer_selected );
@woogist
woogist / gist:c3c13c03a1fdc4b9c823
Created September 29, 2014 09:10
WooCommerce - add extra checkout fields to WooCommerce emails
<?php
/**
* Add the field to order emails
**/
add_filter('woocommerce_email_order_meta_keys', 'my_custom_checkout_field_order_meta_keys');
function my_custom_checkout_field_order_meta_keys( $keys ) {
$keys[] = 'My Field 1';
$keys[] = 'My Field 2';
return $keys;
<?php
// add custom column headers
function wc_csv_export_modify_column_headers( $column_headers ) {
$new_headers = array(
'column_1' => 'Column 1',
'column_2' => 'Column 2',
// add other column headers here in the format column_key => Column Name
);
@bekarice
bekarice / wc-admin-new-order-email-change-subject.php
Last active October 20, 2022 11:25
Add customer name to WooCommerce Admin New Order Email subject
<?php // only copy this line if needed!
/**
* Adds customer first and last name to admin new order email subject.
*
* @param string $subject email subject
* @param \WC_Order $order the order object for the email
* @return string updated subject
*/