Skip to content

Instantly share code, notes, and snippets.

@helgatheviking
helgatheviking / simple.php
Last active January 27, 2022 16:42
Simple add to cart template - adds ajax add to cart support to simple products
<?php
/**
* Simple product add to cart with core ajax add to cart support
*
* This template should be saved to yourtheme/woocommerce/single-product/add-to-cart/simple.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
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
@helgatheviking
helgatheviking / readme.md
Created February 13, 2020 16:38
Add Name Your Price support to Braintree Subscription product types

Name Your Price Compatibility for Braintree Subscriptions

Contributors: Kathy Darling
Requires at least: 5.4.0
Tested up to: 5.4.0
Stable tag: 1.0.0 License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
WC requires at least: 3.9.0
WC tested up to: 3.9.0

@helgatheviking
helgatheviking / patch-missing-jpg
Created February 4, 2020 02:31
Wordpress patch a missing JPG in image tag on save
/*
* Patch missing JPG from img
* @param int $post_ID Post ID.
* @param WP_Post $post_after Post object following the update.
*/
function kia_patch_missing_img_tags( $post_id, $post ) {
// If this is a revision, get real post ID
if ( $parent_id = wp_is_post_revision( $post_id ) ) {
$post_id = $parent_id;
}
@helgatheviking
helgatheviking / kia-disable-cog-module-for-mnm.php
Created December 17, 2019 01:50
Disable Cost of Goods Compat Module in Mix and Match
<?php
/**
* Plugin Name: Disable Cost of Goods Compat Module in Mix and Match
* Plugin URI: https://woocommerce.com/
* Description: Disable Cost of Goods Compat Module in Mix and Match
* Version: 1.0.0
* Author: Kathy Darling
* Author URI: http://kathyisawesome.com/
* Requires at least: 5.3.0
* Tested up to: 5.3.0
@helgatheviking
helgatheviking / wc-minimalize-checkout.php
Created December 12, 2019 15:12
Reduce WooCommerce checkout to the bare minimum
<?php
/**
* Plugin Name: WC Minimalize Checkout Settings
* Plugin URI: https://woocommerce.com/
* Description: Reduce checkout to the bare minimum.
* Version: 1.0.0
* Author: Kathy Darling
* Author URI: http://kathyisawesome.com/*
* Requires at least: 5.3.0
* Tested up to: 5.3.0
@helgatheviking
helgatheviking / mnm-items-wrapper-open.php
Created November 8, 2019 22:57
Mix and Match Grid Options Wrapper for Avada Theme
<?php
/**
* Mix and Match Options Wrapper
*
* This template can be overridden by copying it to yourtheme/woocommerce/single-product/mnm/grid/mnm-items-wrapper-open.php.
*
* HOWEVER, on occasion WooCommerce Mix and Match will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
@helgatheviking
helgatheviking / wc-addons-global-per-product.php
Last active April 1, 2021 01:52
Apply global WooCommerce Product Add-ons on a per-product basis
<?php
/*
* Plugin Name: Global WooCommerce Add-ons per Product
* Plugin URI: https://www.paypal.me/helgatheviking
* Description: Apply global Product Add-ons on a per-product basis
* Version: 1.0.0
* Author: Kathy Darling
* Author URI: http://kathyisawesome.com
* Requires at least: 5.3.0
* WC requires at least: 3.8.0
@helgatheviking
helgatheviking / wc-auto-checkout.php
Created November 7, 2019 15:30
Clicking checkout in the cart auto creates an order. Must have Cash On Delivery gateway enabled.
<?php
/*
* Plugin Name: Auto Checkout for WooCommerce
* Plugin URI: https://www.paypal.me/helgatheviking
* Description: Clicking checkout in the cart auto creates an order. Must have Cash On Delivery gateway enabled.
* Version: 1.0.0
* Author: Kathy Darling
* Author URI: http://kathyisawesome.com
* Requires at least: 5.3.0
* WC requires at least: 3.8.0
@helgatheviking
helgatheviking / wc-add-field-to-variation.php
Created October 30, 2019 00:51
Example of how to add custom fields to WooCommmerce variations admin and display on front end.
<?php
/**
* Plugin Name: Add sample field to variations
* Plugin URI: https://kathyisawesome.com/
* Description: Example of how to add custom fields to variations admin and display on front end.
* Version: 0.1.0
* Author: helgatheviking
* Author URI: https://kathyisawesome.com
* Text Domain: extra-variation-data
*
@helgatheviking
helgatheviking / wc-only-item-in-cart.php
Created October 7, 2019 15:35
Forces certain WooCommerce products to be purchased as the only item in cart
<?php
/**
* Plugin Name: Only Item in WooCommerce Cart
* Plugin URI: https://gist.github.com/helgatheviking/d1e41b5082a66c46afbe8e7e3c4b3244
* Description: Forces certain products to be purchased as the only item in cart
* Version: 1.0.0
* Author: Kathy Darling
* Author URI: http://kathyisawesome.com
* Requires at least: 5.2.0
* WC requires at least: 3.6.0