Skip to content

Instantly share code, notes, and snippets.

@helgatheviking
helgatheviking / wc-optional-redirect-to-checkout.php
Last active February 2, 2023 14:46
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.1
* Author: Kathy Darling
* Author URI: http://kathyisawesome.com
* Requires at least: 3.8
* Tested up to: 3.9
@helgatheviking
helgatheviking / KIA-comment-blacklist.txt
Last active January 28, 2023 09:06
Customizing the WordPress Install Process with install.php - All files go in your /wp-content/ folder. http://www.kathyisawesome.com/421/customizing-wordpress-install/
View KIA-comment-blacklist.txt
_abercrombie
_account
_adidas
_advantage
_alviero
_article
_asics
_babe
_backup
_barata
@helgatheviking
helgatheviking / wc-bcc-emails.php
Last active January 7, 2023 22:44
Add BCC to certain store emails
View wc-bcc-emails.php
/**
* Add BCC to certain store emails.
*
* @param string $headers
* @param string $email_id
* @return string
*/
function kia_add_bcc_to_specific_emails( $headers, $email_id ) {
$bbc_these_emails = array(
@helgatheviking
helgatheviking / kia-sample-custom-field-for-woocommerce.php
Last active January 5, 2023 12:38
Add a custom text field to a WooCommerce Product
View kia-sample-custom-field-for-woocommerce.php
<?php
/**
* Plugin Name: Sample Customizable Product Field for WooCommerce
* Plugin URI: https://www.kathyisawesome.com/add-a-custom-field-to-woocommerce-product/
* Description: Add a custom text field to a WooCommerce Product
* Version: 1.1.0
* Author: Kathy Darling
* Author URI: http://kathyisawesome.com
* Requires at least: 5.2.0
* Tested up to: 5.2.2
@helgatheviking
helgatheviking / add-taxonomy-to-woocommerce-export.php
Last active December 4, 2022 01:19
Add a custom taxonomy to WooCommerce import/export
View add-taxonomy-to-woocommerce-export.php
<?php
/*
* Plugin Name: WooCommerce Add Taxonomy to Export
* Plugin URI: https://gist.github.com/helgatheviking/114c8df50cabb7119b3c895b1d854533/
* Description: Add a custom taxonomy to WooCommerce import/export.
* Version: 1.0.1
* Author: Kathy Darling
* Author URI: https://kathyisawesome.com/
*
* Woo: 18716:fbca839929aaddc78797a5b511c14da9
@helgatheviking
helgatheviking / class-wc-kia-class-email.php
Last active November 13, 2022 02:51
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 / display-attributes-as-table.php
Created May 21, 2020 14:52
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 / custom-modal-metabox.js
Last active November 2, 2022 14:49
Create a completely custom media frame (WIP)
View custom-modal-metabox.js
/**
* @type {Object} JavaScript namespace for our application.
*/
var Custom_Modal = {};
(function($, Custom_Modal) {
var $ = jQuery;
_.extend( Custom_Modal, { view: {}, controller: {} } );
@helgatheviking
helgatheviking / shortcodes.php
Last active October 11, 2022 21:46
WooCommerce display a single product add to cart form with [add_to_cart_form]
View shortcodes.php
/**
* NB: updated version available here: https://github.com/helgatheviking/add-to-cart-form-shortcode
*/
/**
* Add [add_to_cart_form] shortcode that display a single product add to cart form
* Supports id and sku attributes [add_to_cart_form id=99] or [add_to_cart_form sku=123ABC]
* Essentially a duplicate of the [product_page]
* but replacing wc_get_template_part( 'content', 'single-product' ); with woocommerce_template_single_add_to_cart()
*
@helgatheviking
helgatheviking / kia_add_script_to_footer.php
Created February 24, 2017 18:09
Add plus and minus buttons to WooCommerce quantity inputs
View kia_add_script_to_footer.php