Skip to content

Instantly share code, notes, and snippets.

Jared Burke jdeeburke

View GitHub Profile
@jdeeburke
jdeeburke / .bashrc
Created Apr 29, 2020
GitHub Helper Shell Commands
View .bashrc
# Only tried this on mac, would probably need some adaptation for Linux folks :)
#
# Add this to your .bashrc or .zshrc file and reload terminal for it to take effect
# Output GitHub PR URL for the current git repo
ghpr() {
repo=$(git remote -v | sed -n 's/^origin.*git@github\.com:\(.*\)\.git.*fetch.*/\1/p')
branch=$(git branch --show-current)
echo "https://github.com/$repo/compare/$branch?expand=1"
}
@jdeeburke
jdeeburke / functions.php
Last active Mar 10, 2020
Jilt support for WooCommerce Phone Orders
View functions.php
<?php
// Add the following snippet to your theme's functions.php file, or use a plugin like Code Snippets.
add_action( 'init', function() {
// Only make changes as long as Jilt for WooCommerce is installed and connected to Jilt
if ( function_exists( 'wc_jilt' ) && wc_jilt()->get_integration()->is_jilt_connected() ) {
// Disable Storefront JS for Phone Order carts
@jdeeburke
jdeeburke / functions.php
Last active Jan 12, 2020
Jilt for EDD Manual Payments Compatibility Snippet
View functions.php
<?php
// Add this to your theme's functions.php file or use a plugin
// like Code Snippets - https://wordpress.org/plugins/code-snippets/
add_action( 'edd_payment_saved', function( $payment_id, $payment ) {
// EDD Manual Payment callback
if ( doing_action( 'edd_create_payment' ) ) {
@jdeeburke
jdeeburke / sv-wc-memberships-as-3-fix.php
Last active Nov 8, 2019
WooCommerce Memberships & WooCommerce Follow-ups compatibility workaround
View sv-wc-memberships-as-3-fix.php
<?php
/*
* Plugin Name: WooCommerce Memberships ActionScheduler 3.0 Temporary Workaround
* Description: This is a temporary workaround to prevent fatal errors when using WooCommerce Memberships and WooCommerce Follow-up Emails.
* Author: SkyVerge
* Version: 1.0
*/
defined('ABSPATH') or exit;
@jdeeburke
jdeeburke / functions.php
Last active Jul 29, 2019
Jilt Workality Plus workaround
View functions.php
<?php
// Add the following snippet below the line to the bottom of your theme's functions.php file or by using the Code Snippets plugin: https://wordpress.org/plugins/code-snippets/
/******************************************************************************/
add_action( 'save_post', function( $post_id, $post ) {
if ( doing_action( 'action_scheduler_stored_action' ) || doing_action( 'woocommerce_webhook_process_delivery' ) ) {
unset( $_REQUEST['pts_post_type'] );
}
@jdeeburke
jdeeburke / functions.php
Last active May 3, 2019
Jilt for WooCommerce Rocket Loader Exclusion
View functions.php
<?php
add_filter( 'script_loader_tag', 'add_rocket_loader_attribute_to_jilt', 10, 3 );
function add_rocket_loader_attribute_to_jilt( $tag, $handle, $src ) {
if ( 'wc-jilt' === $handle ) {
$tag = '<script data-cfasync="false" type="text/javascript" src="' . esc_url( $src ) . '"></script>';
}
@jdeeburke
jdeeburke / functions.php
Created Sep 18, 2018
Override Google Analytics Pro event name for renewal purchases
View functions.php
<?php
function sv_wc_google_analytics_pro_set_completed_renewal_purchase_event( $parameters ) {
if ( 'completed purchase' === $parameters['ea'] ) {
$order_id = (int) $parameters['el'];
if ( WC_Subscriptions_Renewal_Order::is_renewal( $order_id ) ) {
$parameters['ea'] = 'completed renewal purchase';
@jdeeburke
jdeeburke / functions.php
Last active Sep 6, 2018
WooCommerce Google Analytics Pro Social Login Integration
View functions.php
<?php
/**
* Tracks a social login authentication event with Google Analytics Pro.
*
* @param int $user_id the ID of the user that was just authenticated
* @param string $provider_id the social login provider ID that authenticated the user e.g. `facebook`
*/
function sv_wc_google_analytics_pro_track_social_login_authentication( $user_id, $provider_id ) {
@jdeeburke
jdeeburke / functions.php
Last active Jul 30, 2018
Customer/Order CSV Export: Instantiate Custom Data Store
View functions.php
<?php
function get_custom_csv_export_data_store( $slug ) {
if ( 'my-custom-data-store' === $slug ) {
require_once 'path/to/csv_export_custom_data_store.php';
return new Custom_CSV_Export_Data_Store();
}
@jdeeburke
jdeeburke / csv_export_custom_data_store.php
Created Jul 30, 2018
Customer/Order CSV Export Custom Data Store Example
View csv_export_custom_data_store.php
<?php
class Custom_CSV_Export_Data_Store extends WC_Customer_Order_CSV_Export_Data_Store {
/**
* Persists a single item.
*
* @param \WC_Customer_Order_XML_Export_Suite_Export $export the export object this item is a part of
* @param string $content the content to store
*/
You can’t perform that action at this time.