Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Filter the 'Product tags' placeholder
*/
function prefix_ptuwc_taxonomy_label( $label, $filterable_column ) {
if( $filterable_column == 'product_tag' ) {
$label = 'My new placeholder';
}
return $label;
}
<?php
/**
* Display a single calendar
* Only for use with single day bookings
*/
function prefix_auto_set_end( $auto, $product_id ) {
return 'yes';
}
add_filter( 'bfwc_auto_set_end', 'prefix_auto_set_end', 10, 2 );
<?php
/**
* Find which category is protected by a given password
* @return term_id
*/
function prefix_get_product_category_by_password( $password ) {
$terms = get_terms( array(
'taxonomy' => 'product_cat'
) );
if( $terms ) {
<?php
/**
* Prevent products with add-ons that don't add cost from updating the product price in the cart
* Fixes a compatibility issue with Aelia Currency Switcher with products with set prices in alt currencies
*/
add_filter( 'pewc_ignore_price_with_extras', '__return_true' );
<?php
/**
* Filter the quantity input field classes in Better Variations grid
*/
function prefix_quantity_input_classes( $classes, $product ) {
$classes = 'wcbvp-grid-quantity-field qty';
return $classes;
}
add_filter( 'wcbvp_quantity_input_classes', 'prefix_quantity_input_classes', 10, 2 );
<?php
/**
* Filter the h4 tag
*/
function prefix_field_label_tag( $tag, $item ) {
return 'h4'; // Change your tag here
}
add_filter( 'pewc_field_label_tag', 'prefix_field_label_tag', 100, 2 );
<?php
/**
* Filter heading tag for group headings
*/
function prefix_filter_group_title( $title, $group, $group_id ) {
$group_title = pewc_get_group_title( $group_id, $group, true );
return sprintf( '<h3>%s</h3>', esc_html( $group_title ) ); // Change your tags here
}
add_filter( 'pewc_filter_group_title', 'prefix_filter_group_title', 10, 3 );
.qty-discounted-price {
display: inline-block !important;
width: 30% !important;
position: absolute !important;
right: 80px !important;
}
.qty-percent-savings {
position: absolute !important;
right: 0 !important;
color: green !important;
<?php
/**
* Apply part payment before tax
*/
add_filter( 'wcdpp_apply_part_payment_before_tax', '__return_true' );
<?php
/**
* Filter global role-based discounts
*/
function prefix_role_pricing_rules( $rules, $product=false ) {
if( ! $product ) {
return $rules;
}