This file contains 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( 'wcfad_pewc_adjust_field_prices', 'custom_wcfad_pewc_adjust_field_prices', 10, 3 ); | |
function custom_wcfad_pewc_adjust_field_prices( $adjust, $item, $product_id ) { | |
// if field price is a percentage of the product price, do not adjust | |
if ( $item['field_percentage'] ) { | |
$adjust = false; | |
} | |
return $adjust; | |
} |
This file contains 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 | |
function custom_enable_variations_grid($enable, $product_id) { | |
// Add your specific product IDs here | |
$specific_product_ids = array(234,324,336); // Replace with your product IDs | |
if (in_array($product_id, $specific_product_ids)) { | |
return true; // Enable the grid for specific products | |
} |
This file contains 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 | |
function tester_remove_fields_from_before_button() { | |
global $product; | |
if ( $product->get_type() == 'variable' ) { | |
remove_action( 'woocommerce_before_add_to_cart_button', 'pewc_product_extra_fields' ); |
This file contains 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 | |
/** | |
* This function updates a 'tutor_enrolled' post type after it is created by a scheduled order. Changing the status prevents them from being counted towards totals. | |
*/ | |
function wcdpp_tutor_after_enrolled( $course_id, $user_id, $enrolled_id ) { | |
// get the order_id attached to this tutor_enrolled record | |
$order_id = get_post_meta( $enrolled_id, '_tutor_enrolled_by_order_id', true ); | |
if ( $order_id ) { | |
// check if order is a scheduled order |
This file contains 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 | |
function custom_wcmo_is_content_restricted( $is_restricted, $restricted_content ) { | |
if ( $is_restricted ) { | |
// if Restriction Method is User Role, get the value of "If Restricted, Redirect To", usually the login page | |
$redirect_page = get_option( 'wcmo_redirect_restricted', false ); | |
if ( $redirect_page ) { | |
// get the translated ID for the login page using WPML's filter | |
$redirect_page_translated = apply_filters( 'wpml_object_id', $redirect_page, 'page', false ); | |
if ( get_the_ID() == $redirect_page_translated ) { | |
// we are on the translated page, allow this |
This file contains 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( 'wcmo_registration_fields', function( $fields ) { | |
foreach ( $fields as $key => $field ) { | |
switch ( $key ) { | |
case "first_name": | |
$fields[$key]["label"] = "Voornaam"; | |
break; | |
case "last_name": |
This file contains 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 | |
function prefix_required_quote_fields( $fields ) { | |
$fields['phone']['required'] = true; | |
return $fields; | |
} |
This file contains 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 child product category if it's empty ***/ | |
add_filter( 'pewc_filter_item_start_list', function( $item, $group, $group_id, $post_id ) { | |
if ( $item['field_type'] == "product-categories" && empty( $item['child_products'] ) ) { | |
return false; | |
} |
This file contains 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 the default currency field to calculation values in cart **/ | |
add_filter( 'pewc_filter_item_value_in_cart', function( $field_value, $field ) { | |
if ( $field['type'] == "calculation" ) { | |
$field_value = get_woocommerce_currency_symbol() . $field_value; | |
} | |
return $field_value; | |
}, 10, 2 ); |
This file contains 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
/** Show 4 columns on iPad, Tablets **/ | |
@media (min-width: 481px) and (max-width: 768px){ | |
.pewc-radio-images-wrapper .pewc-radio-image-wrapper, .pewc-checkboxes-images-wrapper .pewc-checkbox-image-wrapper { | |
width: 25%; | |
} | |
} | |
/** Show 4 columns on Mobile devices **/ |