This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Remove tax from price entered in back-end | |
add_filter( 'pewc_auto_detect_tax_rate_for_adjustment', '__return_true' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Dynamically create options for select field | |
* Enter a pattern in the 'label' field of the first option of your select field | |
* 0.4}}0.5}}0.01 | |
* start||end||step | |
*/ | |
function demo_dynamic_select_field( $item, $group, $group_id, $post_id ) { | |
if( ! empty( $item['field_options'] ) && str_contains( $item['field_options'][0]['value'], '||') ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.pewc-preset-style .pewc-radio-image-wrapper { | |
border-color: transparent; | |
} | |
.pewc-radio-image-desc { | |
line-height: 1.3; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Disable quantity field in cart for specific products | |
*/ | |
function pr_disable_cart_item_quantity( $product_quantity, $cart_item_key, $cart_item ) { | |
if( in_array( $cart_item['product_id'], array( 3660 ) ) ) { // Enter list of your product IDs here | |
if ( is_cart() ) { | |
$product_quantity = sprintf( '<strong>%s</strong><input type="hidden" name="cart[%s][qty]" value="%s" />', $cart_item['quantity'], $cart_item_key, $cart_item['quantity'] ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add this snippet to allow users to add child products directly to their cart | |
* Update the list in line 7 with the IDs of fields containing child products | |
*/ | |
function demo_get_free_sample_field_ids() { | |
return array( 123, 456, 789 ); // Update this list with your own field IDs | |
} | |
function demo_child_product_wrapper_classes( $wrapper_classes, $child_product_id, $item ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Programmatically create swatches fields using images that have already been uploaded to your media library | |
*/ | |
function demo_filter_item_start_list( $item, $group, $group_id, $post_id ) { | |
$field_id = $item['field_id']; | |
if( $field_id != 978 ) { // Change this to the ID of your field | |
return $item; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'pewc_enable_formulas_in_prices', '__return_true' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.woocommerce-variation-add-to-cart, :is(.elementor-widget-woocommerce-product-add-to-cart,.woocommerce div.product .elementor-widget-woocommerce-product-add-to-cart,.elementor-widget-wc-add-to-cart,.woocommerce div.product .elementor-widget-wc-add-to-cart) form.cart:not(.grouped_form):not(.variations_form) { | |
display: flex; | |
flex-wrap: wrap; | |
} | |
.pewc-product-extra-groups-wrap { | |
width: 100% | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Filter BXGY rule by brand taxonomy instead of category | |
*/ | |
function demo_bxgy_taxonomy( $taxonomy, $rule, $rule_id ) { | |
$taxonomy = 'product_brand'; // Change this to the taxonomy or tag of your choice | |
return $taxonomy; | |
} | |
add_filter( 'wcfad_validate_bxgy_rule_taxonomy', 'demo_bxgy_taxonomy', 10, 3 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Hide all field and option prices on the front end | |
*/ | |
function demo_hide_all_add_on_prices( $item, $group, $group_id, $post_id ) { | |
$item['price_visibility'] = 'hidden'; | |
$item['option_price_visibility'] = 'hidden'; | |
return $item; | |
} | |
add_filter( 'pewc_filter_item_start_list', 'demo_hide_all_add_on_prices', 10, 4 ); |
NewerOlder