Skip to content

Instantly share code, notes, and snippets.

View funkysoul's full-sized avatar

Tiago Dias funkysoul

  • thekitchen.agency
  • Zurich, Switzerland
  • 03:07 (UTC +02:00)
View GitHub Profile
jQuery.ajax({
type : "post",
dataType : "json",
url : wpajaxurl.ajaxurl,
data : {action: "signupform", form_id : 37 },
success: function(response) {
if(response.success) {
jQuery('#formcontainer').append(response.form);
}
else {
@funkysoul
funkysoul / gist:0272864621d1ae8fc25aaeed6b85f8ad
Created January 24, 2017 11:49
WooCommerce copy fields from wp_usermeta table to xyz
UPDATE wp_usermeta AS target
LEFT JOIN wp_usermeta AS source ON source.user_id = source.user_id AND source.meta_key = 'billing_last_name'
SET target.meta_value = source.meta_value
WHERE target.user_id = source.user_id AND target.meta_key = 'last_name'
@funkysoul
funkysoul / gist:c27bb013adb9cb847cfff4f5ee8c3847
Created January 14, 2017 10:17
woocommerce category tree
//GET CATEGORIES FOR NAVIGATION
add_action('tauchbar_get_cats', 'getCatTree', 15);
function getCatTree(){
$taxonomy = 'product_cat';
$orderby = 'name';
$show_count = 0; // 1 for yes, 0 for no
$pad_counts = 0; // 1 for yes, 0 for no
$hierarchical = 1; // 1 for yes, 0 for no
$title = '';
$empty = 0;
@funkysoul
funkysoul / hide-shipping-methods.php
Created January 27, 2016 17:57
Woocommerce Snippet on hiding all shipment methods when free shipping is available
add_filter( 'woocommerce_available_shipping_methods', 'hide_all_shipping_when_free_is_available' , 10, 1 );
function hide_all_shipping_when_free_is_available( $available_methods ) {
if( isset( $available_methods['free_shipping'] ) ) :
$freeshipping = array(); $freeshipping = $available_methods['free_shipping'];
array unset( $available_methods );
$available_methods = array();
$available_methods[] = $freeshipping;
endif;
@funkysoul
funkysoul / min-variation-price.php
Last active January 27, 2016 17:46
Woocommerce Snippet on how to change the variation price so it only displays the lowest
add_filter('woocommerce_variable_price_html', 'custom_variation_price', 10, 2);
function custom_variation_price( $price, $product ) {
$price = '';
if ( !$product->min_variation_price || $product->min_variation_price !== $product->max_variation_price ) $price .= '<span class="from">' . _x('Ab&nbsp;', 'min_price', 'woocommerce') . ' </span>';
$price .= woocommerce_price($product->min_variation_price);
return $price;
}