Skip to content

Instantly share code, notes, and snippets.

Damien Carbery damiencarbery

Block or report user

Report or block damiencarbery

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View cart-contents-shortcode.php
// To the CF7 form add:
// [dynamichidden dynamichidden-cart "cart_contents"]
// In the CF7 Mail add:
// [dynamichidden-cart]
// The "cart_contents" uses this code
add_shortcode( 'cart_contents', 'dcwd_cart_contents' );
function dcwd_cart_contents($atts, $content, $code) {
$cart_contents = array();
View wc-order-history-test.php
Plugin Name: WooCommerce Order History Test
Plugin URI:
Description: Quick experiment with adding order history info to My Orders tab.
Author: Damien Carbery
Version: 0.1
$Id: $
View wc-free-shipping-notice.php
Plugin Name: WooCommerce - Free Shipping Notice
Plugin URI:
Description: Add note about free shipping for all except one product.
Author: Damien Carbery
Version: 0.1
View eircode-ireland-addresses.php
Plugin Name: Eircode field for Irish addresses
Plugin URI:
Description: Eircode field for Ireland addresses in WooCommerce.
Author: Damien Carbery
Version: $Revision: $
damiencarbery / my-dashboard.php
Created Dec 20, 2016
Customise WooCommerce template files in a plugin
View my-dashboard.php
* My Account Dashboard
* Shows the first intro screen on the account dashboard.
* This template can be overridden by copying it to yourtheme/woocommerce/myaccount/dashboard.php.
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
damiencarbery / conditional-debug-code.php
Last active Jan 20, 2017
Debugging with WordPress - enable WP_DEBUG, with sample usage to investigate wc_get_template()
View conditional-debug-code.php
// Only call error_log() when in debug mode.
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
error_log('WP_DEBUG is enabled');
damiencarbery / basic-get-site-title.php
Last active Jan 27, 2017
Standalone WordPress Scripts
View basic-get-site-title.php
define('WP_USE_THEMES', false);
require( 'wp-blog-header.php' );
bloginfo( 'name' );
View add-cf7-popup-to-product-page.php
Plugin Name: CF7 to product page
Plugin URI:
Description: Add a Contact Form 7 form to the product page.
Author: Damien Carbery
Version: 0.1
WC tested up to: 3.6.4
damiencarbery / aj-demo-ajax-code.js
Last active May 17, 2019
Demo of AJAX in WordPress
View aj-demo-ajax-code.js
jQuery(document).ready( function(){
jQuery('.count_btn').on('click', function(e) {
var post_type = jQuery(this).data( 'type' ); // Get post type via the 'data-type' attribute of the button.
jQuery('#'+post_type+'_count').html('?'); // Clear existing value.
url : aj_ajax_demo.ajax_url, // Note that 'aj_ajax_demo' is from the wp_localize_script() call.
damiencarbery / rac-calc-free-shipping-min-amount.php
Last active Feb 13, 2017
Woocommerce - Promote Free Shipping
View rac-calc-free-shipping-min-amount.php
// Code inspired by
function rac_get_free_shipping_amount( $package ) {
$all_zones = WC_Shipping_Zones::get_zones();
$shipping_zone = WC_Shipping_Zones::get_zone_matching_package( $package );
$min_amounts = array();
// Verify that the shipping zone is in $all_zones (zone id 0 isn't!)
if ( array_key_exists( $shipping_zone->get_id(), $all_zones ) ) {
$methods = $all_zones[ $shipping_zone->get_id() ][ 'shipping_methods' ];
You can’t perform that action at this time.