Skip to content

Instantly share code, notes, and snippets.

View prefix_enable_image_editing.php
<?php
/**
* Enable image editing for certain products
*/
function prefix_enable_image_editing( $enabled ) {
$product_id = get_the_ID();
if( in_array( $product_id, array( 123, 456, 789 ) ) ) {
$enabled = 'yes';
}
return $enabled;
View pewc_rename_uploaded_file.php
<?php
/**
* Fix issue with Divi compatibility
*/
remove_filter( 'sanitize_file_name', 'pewc_rename_uploaded_file' );
View ptuwc_placeholder_label.php
<?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;
}
View bfwc_auto_set_end.php
<?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 );
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;