Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Reduce option and field prices by 10%
*/
function demo_discount_field_price( $price, $item, $product ) {
$price = $price * 0.9;
return $price;
}
<?php
/**
* Allow independent child product quantities to be edited in cart
*/
remove_filter( 'pewc_filter_quantity_field', 'pewc_force_quantity_field', 10, 6 );
<?php
/**
* Quickview markup adjustment for Elementor
*/
remove_action( 'wp_footer', 'pewc_display_quickview_background' );
function demo_display_quickview_background() {
if( did_action( 'woocommerce_after_add_to_cart_button' ) > 2 ) {
return;
}
if( pewc_child_product_quickview() == 'yes' ) { ?>
<?php
/**
* Change the product name for a child product
*/
function demo_change_child_product_title( $title, $child_product ) {
if( ! is_object( $child_product ) || is_wp_error( $child_product ) ) {
return $title;
}
if( $child_product->get_id() == 1234 ) { // Update your child product ID here
$title = 'New name here'; // Change your new text here
<?php
/**
* Text Preview / X Theme compatibility
*/
add_filter( 'apaou_field_gallery_container', function( $container, $item ){
return 'swiper-wrapper.main-images';
}, 10, 2 );
add_filter( 'apaou_control_container', function( $container, $product ){
return 'swiper-wrapper.thumbnails-list';
<?php
/**
* Update the three IDs below with your own field IDs
*/
function demo_get_start_date_field_id() {
return 1245; // The ID of the date field for the start date
}
function demo_get_end_date_field_id() {
return 1246; // The ID of the date field for the end date
}
<?php
/**
* Dynamically set the aspect ratio for an upload field using Advanced Uploads
*/
function demo_ar_get_field_id() {
// Update the field ID below to your select field ID
return 1242;
}
function demo_ar_option_attribute_string( $option_attribute_string, $item, $option_value, $option_index ) {
<?php
/**
* Allow 0 value in 'Number' fields
*/
add_filter( 'pewc_allow_empty_field_values', '__return_true' );
<?php
/**
* Remove thumbs from cart
*/
add_filter( 'pewc_show_link_only_cart', '__return_true' );
/**
* Remove thumbs from order page
*/
add_filter( 'pewc_remove_thumbs_in_order_page', '__return_true' );
<a href="https://pluginrepublic.com/woocommerce-hooks-actions-filters/"><img width="1672" alt="WooCommerce product page hooks" src="https://pluginrepublic.com/wp-content/uploads/2025/10/woocommerce-single-product-page-template-hooks.jpg"></a>