Skip to content

Instantly share code, notes, and snippets.

View wcmo_redirect_url.php
<?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 ) {
View pewc_ignore_price_with_extras.php
<?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' );
View wcbvp_quantity_input_classes.php
<?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 );
View pewc_field_label_tag.php
<?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 );
View pewc_filter_group_title.php
<?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 );
View stickermule.css
.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;
View wcdpp_apply_part_payment_before_tax.php
<?php
/**
* Apply part payment before tax
*/
add_filter( 'wcdpp_apply_part_payment_before_tax', '__return_true' );
View wcfad_role_pricing_rules.php
<?php
/**
* Filter global role-based discounts
*/
function prefix_role_pricing_rules( $rules, $product=false ) {
if( ! $product ) {
return $rules;
}
View prefix_get_bookings_ending.php
<?php
/**
* Get all bookings with an end date in a specified number of days time
*/
function prefix_get_bookings_ending() {
// How many days in advance should we send the email?
$days = 3;
$date = date( 'Y-m-d', strtotime( '+' . absint( $days ) . 'days' ) );
error_log( $date );
View woocommerce_product_tabs.php
<?php
/**
* Rename product data tabs
*/
function woo_rename_tabs( $tabs ) {
$tabs['additional_information']['title'] = __( 'Product Data' );
return $tabs;
}
add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 );