Skip to content

Instantly share code, notes, and snippets.

Pablo dos Santos Gonçalves Pacheco pablo-sg-pacheco

Block or report user

Report or block pablo-sg-pacheco

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pablo-sg-pacheco
pablo-sg-pacheco / functions.php
Created Oct 11, 2019 — forked from TimBHowe/functions.php
Forcibly remove the tax line item and calculation from the cart. (suggest just using the GEO setting in WooCommerce)
View functions.php
<?php
// Remove the Tax Line item from the cart.
function wc_remove_cart_tax_totals( $tax_totals, $instance ) {
if( is_cart() ) {
$tax_totals = array();
}
return $tax_totals;
}
@pablo-sg-pacheco
pablo-sg-pacheco / functions.php
Last active Jan 31, 2018 — forked from jayarnielsen/functions.php
WP Query Orderby Taxonomy Term Name
View functions.php
<?php
add_filter('posts_clauses', 'posts_clauses_with_tax', 10, 2);
function posts_clauses_with_tax( $clauses, $wp_query ) {
global $wpdb;
//array of sortable taxonomies
$taxonomies = array('example-taxonomy', 'other-taxonomy');
if (isset($wp_query->query['orderby']) && in_array($wp_query->query['orderby'], $taxonomies)) {
$clauses['join'] .= "
LEFT OUTER JOIN {$wpdb->term_relationships} AS rel2 ON {$wpdb->posts}.ID = rel2.object_id
LEFT OUTER JOIN {$wpdb->term_taxonomy} AS tax2 ON rel2.term_taxonomy_id = tax2.term_taxonomy_id
@pablo-sg-pacheco
pablo-sg-pacheco / function.php
Last active Apr 19, 2017 — forked from hlashbrooke/function.php
WooCommerce - Check if you are running a specified WooCommerce version (or higher)
View function.php
<?php
function woocommerce_version_check( $version = '3.0' ) {
if ( class_exists( 'WooCommerce' ) ) {
global $woocommerce;
if( version_compare( $woocommerce->version, $version, ">=" ) ) {
return true;
}
}
return false;
}
You can’t perform that action at this time.