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 | |
/** | |
* Redirect users after registration | |
*/ | |
function demo_registration_redirect( $redirect_url ) { | |
$redirect_url = '/shop'; // Redirect to shop | |
return $redirect_url; | |
} | |
add_filter( 'woocommerce_registration_redirect', 'demo_registration_redirect' ); |
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 attributes from product names of variation child products | |
*/ | |
function demo_filter_child_product_title( $title, $child_product ) { | |
if( ! is_object( $child_product ) || is_wp_error( $child_product ) ) { | |
return $title; | |
} | |
if( $child_product->get_type() == 'variation' ) { | |
$parent_id = $child_product->get_parent_id(); |
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
/** Show single column on mobile, tablets, etc **/ | |
@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: 100%; | |
} | |
} | |
/** Show 4 columns on mobile, tablets, etc **/ | |
@media (min-width: 481px) and (max-width: 768px){ | |
.pewc-radio-images-wrapper .pewc-radio-image-wrapper, .pewc-checkboxes-images-wrapper .pewc-checkbox-image-wrapper { |
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 | |
function demo_quantity_input_min( $min, $product ) { | |
return 0; | |
} | |
add_filter( 'woocommerce_quantity_input_min', 'demo_quantity_input_min', 10 , 2 ); |
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 | |
/** | |
* Move uploaded images to media library and thence to third-party storage like Amazon S3 etc | |
*/ | |
add_filter( 'pewc_offload_media', '__return_true' ); | |
function demo_upload_image( $uploaded_files ) { | |
$moved_files = array(); |
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 a custom parameter to add-on field settings | |
*/ | |
function demo_add_class_parameter( $group_key, $item_key, $item, $post_id ) { | |
echo '<div class="pewc-fields-wrapper pewc-my-new-fields">'; | |
echo '<div class="product-extra-field-third">'; | |
$class = isset( $item['class'] ) ? $item['class'] : ''; | |
echo '<label>Class</label>'; | |
echo '<input type="text" class="pewc-field-class" name="_product_extra_groups_' .esc_attr( $group_key ) . '_' . esc_attr( $item_key ) . '[class]" value="'. esc_html( $class ).'">'; |
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 custom class parameter to swatch options | |
*/ | |
function demo_custom_class_param( $option_count, $group_id, $item_key, $item, $key ) { | |
$name = '_product_extra_groups_' . esc_attr( $group_id ) . '_' . esc_attr( $item_key ) . '[field_options][' . esc_attr( $option_count ) . ']'; | |
$class = isset( $item['field_options'][esc_attr( $key )]['class'] ) ? $item['field_options'][esc_attr( $key )]['class'] : ''; | |
?> | |
<td class="pewc-option-extra"> | |
<input type="text" class="pewc-field-option-class" name="<?php echo $name; ?>[class]" value="<?php echo esc_attr( $class ); ?>"> |
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 | |
/** | |
* Return a step value of 100 for a specific field ID | |
* Update the field ID in line 8 below | |
* Update the step value in line 9 if you wish | |
*/ | |
function demo_number_field_step( $step, $item ) { | |
if( $item['field_id'] == 12345 ) { | |
return 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 | |
function demo_radio_label_classes( $label_classes, $item, $option_value, $option_index ) { | |
// Check for custom params | |
if( ! empty( $item['field_options'][$option_index]['required_field_id'] ) ) { | |
$label_classes[] = 'pewc-option-conditions'; | |
} | |
return $label_classes; | |
} | |
add_filter( 'pewc_radio_label_classes', 'demo_radio_label_classes', 10, 4 ); | |
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' ); |
NewerOlder