Skip to content

Instantly share code, notes, and snippets.

View ConradGalli's full-sized avatar
🙂
C'est la vie

Conra ConradGalli

🙂
C'est la vie
  • Córdoba, Argentina
View GitHub Profile
@ConradGalli
ConradGalli / remove-all-product-categories-tags.php
Created May 7, 2021 22:04 — forked from mikaelz/remove-all-product-categories-tags.php
Remove all WooCommerce product categories and tags
<?php
require dirname(__FILE__).'/wp-blog-header.php';
$wpdb->query("DELETE a,c FROM wp_terms AS a
LEFT JOIN wp_term_taxonomy AS c ON a.term_id = c.term_id
LEFT JOIN wp_term_relationships AS b ON b.term_taxonomy_id = c.term_taxonomy_id
WHERE c.taxonomy = 'product_tag'");
$wpdb->query("DELETE a,c FROM wp_terms AS a
LEFT JOIN wp_term_taxonomy AS c ON a.term_id = c.term_id
@ConradGalli
ConradGalli / custom-package-name.php
Created December 18, 2016 21:06 — forked from hereswhatidid/custom-package-name.php
Create custom shipping packages and manually set their display names in WooCommerce
<?php
add_filter( 'woocommerce_shipping_package_name', 'rmg_package_names', 10, 3 );
function rmg_package_names( $package_name, $i, $package ) {
if ( ! empty( $package['name'] ) ) {
$package_name = $package['name'];
}
@ConradGalli
ConradGalli / wc-hide-flat-rate-shipping.php
Created November 4, 2016 22:49 — forked from maxrice/wc-hide-flat-rate-shipping.php
Hide default flat rate shipping method when free shipping is available
// Hide standard shipping option when free shipping is available
add_filter( 'woocommerce_available_shipping_methods', 'hide_standard_shipping_when_free_is_available' , 10, 1 );
/**
* Hide Standard Shipping option when free shipping is available
*
* @param array $available_methods
*/
function hide_standard_shipping_when_free_is_available( $available_methods ) {
@ConradGalli
ConradGalli / woocommerce-email-new-address.php
Created October 1, 2015 16:37 — forked from BFTrick/woocommerce-email-new-address.php
Email the site admin when a customer changes their address
<?php
/**
* Plugin Name: WooCommerce Email Customer Address
* Plugin URI: https://gist.github.com/BFTrick/7891074
* Description: Email the site admin when a customer changes their address
* Author: Patrick Rauland
* Author URI: http://patrickrauland.com/
* Version: 1.0
*
* This program is free software: you can redistribute it and/or modify
<?php
/*
Plugin Name: Your Shipping plugin
Plugin URI: http://woothemes.com/woocommerce
Description: Your shipping method plugin
Version: 1.0.0
Author: WooThemes
Author URI: http://woothemes.com
*/
add_filter( 'woocommerce_order_formatted_billing_address' , 'woo_custom_order_formatted_billing_address' );
/**
* woo_custom_order_formatted_billing_address
*
* @access public
* @since 1.0
* @return void
*/
function woo_custom_order_formatted_billing_address() {
add_filter( 'woocommerce_order_formatted_shipping_address' , 'woo_custom_order_formatted_shipping_address' );
/**
* woo_custom_order_formatted_shipping_address
*
* @access public
* @since 1.0
* @return void
*/
function woo_custom_order_formatted_shipping_address() {
<!-- http://benalman.com/projects/jquery-urlinternal-plugin/ -->
<script src='<?php bloginfo('template_directory'); ?>/js/jquery.ba-urlinternal.min.js'></script>
<!-- http://www.asual.com/jquery/address/ -->
<script src='<?php bloginfo('template_directory'); ?>/js/jquery.address-1.3.min.js'></script>
<script>
// Original JavaScript by Chris Coyier
// Updated October 2010 by Stewart Heckenberg & Chris Coyier
add_action( 'woocommerce_email_after_order_table', 'add_payment_method_to_admin_new_order', 15, 2 );
/**
* Add used coupons to the order confirmation email
*
*/
function add_payment_method_to_admin_new_order( $order, $is_admin_email ) {
if ( $is_admin_email ) {