Skip to content

Instantly share code, notes, and snippets.

@helgatheviking
helgatheviking / display-attributes-as-table.php
Created May 21, 2020
Display the WooCommerce product attributes as a table element via shortcode [display_attributes]
View display-attributes-as-table.php
<?php
/**
* Attributes shortcode callback.
*/
function so_39394127_attributes_shortcode( $atts ) {
global $product;
if( ! is_object( $product ) || ! $product->has_attributes() ){
@helgatheviking
helgatheviking / xdebug-var-dump.css
Created May 12, 2020
Style rules to make var_dump a hell of a lot more readable
View xdebug-var-dump.css
.xdebug-var-dump {
/* These are technically the same, but use both */
overflow-wrap: break-word;
word-wrap: break-word;
-ms-word-break: break-all;
/* This is the dangerous one in WebKit, as it breaks things wherever */
word-break: break-all;
/* Instead use this non-standard one: */
View class-kia-subtitle-bb.php
<?php
/**
* @package KIA Subtitle
* @category Compatibility Class
* @version 3.1.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
@helgatheviking
helgatheviking / add-win-terminal-ubuntu-profile-to-context-menus.reg
Last active Jul 2, 2020
Add "Open Ubuntu Terminal Here" to context menus - Launches Windows Terminal's Ubuntu profile.
View add-win-terminal-ubuntu-profile-to-context-menus.reg
Windows Registry Editor Version 5.00
Replace <<Username>> with your user name!
[HKEY_CLASSES_ROOT\Directory\Background\shell\ubuntu]
@="Open Ubuntu Terminal here"
"Icon"="%USERPROFILE%/AppData/Local/WindowsTerminal/ubuntu.ico"
[HKEY_CLASSES_ROOT\Directory\Background\shell\ubuntu\command]
@="C:\\Users\\<<Username>>\\AppData\\Local\\Microsoft\\WindowsApps\\wt.exe -d . --profile=\"Ubuntu-18.04\""
@helgatheviking
helgatheviking / class-wc-kia-class-email.php
Last active May 19, 2020
Send a WooCommerce Customer email from the Order Admin Actions
View class-wc-kia-class-email.php
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( ! class_exists( 'WC_KIA_Class_Email', false ) ) :
/**
* A custom Order WooCommerce Email class
*
* @since 0.1
* @extends \WC_Email
@helgatheviking
helgatheviking / wc-optional-redirect-to-checkout.php
Last active Jun 18, 2020
Woo Redirect Certain Products to Checkout- How to skip cart page on woocomerce for certain products only?
View wc-optional-redirect-to-checkout.php
<?php
/**
* Plugin Name: WC Redirect to checkout
* Plugin URI: http://stackoverflow.com/q/32962653/383847
* Description: Redirect to checkout for certain products
* Version: 1.0
* Author: Kathy Darling
* Author URI: http://kathyisawesome.com
* Requires at least: 3.8
* Tested up to: 3.9
@helgatheviking
helgatheviking / entry-header.php
Created Apr 19, 2020
Tweny Twenty Child theme | Add Subtitle to entry-header.php
View entry-header.php
<?php
/**
* Displays the post header
*
* @package WordPress
* @subpackage Twenty_Twenty
* @since Twenty Twenty 1.0
*/
$entry_header_classes = '';
@helgatheviking
helgatheviking / wc-disable-billing-address-for-free-checkout.php
Created Apr 17, 2020
Hide billing address fields in checkout when cart total is free
View wc-disable-billing-address-for-free-checkout.php
<?php
/*
* Plugin Name: Disable billing address for free checkout
* Plugin URI: https://gist.github.com/helgatheviking/65fd213e7f13cde029b19c16a275eb3f
* Description: Hiding billing address fields when cart total is free.
* Version: 1.0.0
* Author: Kathy Darling
* Author URI: https://woocommerce.com/products/name-your-price?aff=5151&cid=4951026
* Requires at least: 5.3
* WC requires at least: 4.0
@helgatheviking
helgatheviking / wc-mnm-price-range.php
Created Mar 2, 2020
Change Mix and Match price string from From: $99 to range style $99 - $100
View wc-mnm-price-range.php
<?php
/**
* Change price string from From: $99 to range style $99 - $100
*
* @return string
*/
function kia_mnm_price_range( $price, $product ) {
if ( $product->get_max_container_size() && $product->get_mnm_price( 'max' ) && $product->get_mnm_price( 'min' ) !== $product->get_mnm_price( 'max' ) ) {
$price = sprintf( _x( '%1$s - %2$s', 'Price range', 'woocommerce-mix-and-match-products' ), $price . $product->get_price_suffix(), $product->get_mnm_price( 'max' ) . $product->get_price_suffix() );
@helgatheviking
helgatheviking / wc-mnm-disable-shipstation-compat.php
Created Mar 2, 2020
Mix and Match: Disable Shipstation Compat
View wc-mnm-disable-shipstation-compat.php
<?php
/**
* Plugin Name: Mix and Match: Disable Shipstation Compat
* Plugin URI: https://woocommerce.com/products/woocommerce-mix-and-match-products/?aff=5151&cid=4347782
* Description: This is a short description of what the plugin does. It's displayed in the WordPress admin area.
* Version: 1.0.0
* Author: Kathy Darling
* Author URI: kathyisawesome.com
* License: GPL-2.0+
You can’t perform that action at this time.