Skip to content

Instantly share code, notes, and snippets.

<?php
add_filter( 'bfwc_after_add_to_cart_button', '__return_false' );
<?php
/**
* Exclude specific products from a Product Categories field type
* Edit the $excluded_ids array below with the product IDs you want
* to hide. If you need different exclusions per field, check $args['category'] to
* identify the field and apply exclusions conditionally.
*/
add_filter( 'pewc_get_products_for_cats_args', function( $args ) {
// IDs of products to exclude from all Product Categories fields.
<?php
/**
* Return specified attribute term as product name
* Update pa_size in line 13 with your attribute slug
*/
function pr_child_product_title_size_only( $title, $child_product ) {
if ( ! is_a( $child_product, 'WC_Product_Variation' ) ) {
return $title;
}
<?php
/**
* Filter bump locations
*/
function demo_multiple_bumps() {
return array( 'product', 'checkout' );
}
add_filter( 'wcob_bump_location', 'demo_multiple_bumps' );
<?php
/**
* Enable shipping fields at checkout for booking products
*/
add_filter( 'woocommerce_cart_needs_shipping_address', '__return_true' );
@media screen and (max-width: 999px) {
.pewc-swatch-grid .pewc-radio-images-wrapper.pewc-columns-3,
.pewc-swatch-grid .pewc-checkboxes-images-wrapper.pewc-columns-3 {
grid-template-columns: 1fr 1fr !important;
}
}
<?php
/**
* Don't apply discount to add-on fields
*/
add_filter( 'pewc_disable_wcfad_on_addons', '__return_true' );
// Always display the quantity field
add_filter( 'pewc_hide_quantity', '__return_false' );
<?php
/**
* Add a CSS class to products on archive pages if they have add-on fields.
*/
function demo_add_has_addons_class( $classes ) {
if ( is_archive() || is_shop() ) {
global $product;
if ( $product && 'yes' === pewc_has_product_extra_groups( $product->get_id() ) ) {
$classes[] = 'pewc-has-addons';
}