Skip to content

Instantly share code, notes, and snippets.

<?php
add_filter( 'wcmo_disable_product_data_tab', '__return_true' );
form.cart.variations_form .woocommerce-variation-add-to-cart {
display: block !important;
}
ul.wcdpp-deposit-options-wrapper {
list-style: none !important;
margin-left: 0 !important;
margin-bottom: 2em;
padding-left: 0;
}
ul.wcdpp-deposit-options-wrapper h3 {
<?php
/**
* Hide products from specific category on shop page
* Update line 13 with category slugs to hide
*/
function pr_product_query_tax_query( $tax_query, $query ) {
if( ! is_shop() ) return $tax_query;
$tax_query[] = array(
<?php
/**
* Hide product category from main query
* Update line 17 with the slug of the category to be hidden
*/
function pr_product_query( $q ) {
if ( ! $q->is_main_query() ) return;
if ( ! $q->is_post_type_archive() ) return;
.ptuwc_table_container table thead tr th, .ptuwc_table_container table tbody tr td {
padding-top: 16px;
padding-bottom: 16px;
}
<?php
/**
* Filter product if user not logged in
*/
function pr_demo_is_purchasable( $purchasable, $product ) {
if( !is_user_logged_in() ) {
return false;
}
return $purchasable;
}
<?php
/**
* Filter price for non-logged-in users
*/
function pr_demo_get_price_html( $price, $product ) {
if( !is_user_logged_in() ) {
// Add a custom message here to display instead of the price
return __( 'Price on application', 'your_textdomain' );
}
return $price;
<?php
/**
* Hide products with specific IDs
* Edit line 7 with the IDs you want to hide prices for
*/
add_filter( ‘woocommerce_get_price_html’, function( $price, $product ) {
if( is_admin() ) return $price;
$product_ids = array( 1234, 5678 );
if( in_array( $product->get_id(), $product_ids ) ) {
return '';
<?php
add_filter( ‘woocommerce_get_price_html’, function( $price ) {
if ( is_admin() ) return $price;
return ”;
});
add_filter( ‘woocommerce_cart_item_price’, ‘__return_false’ );
add_filter( ‘woocommerce_cart_item_subtotal’, ‘__return_false’ );
<?php
add_filter( ‘woocommerce_get_price_html’, function( $price ) {
if ( is_admin() ) return $price;
return ”;
});