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 | |
/** | |
* A number field template | |
* @since 2.0.0 | |
* @package WooCommerce Product Add-Ons Ultimate | |
*/ | |
// Exit if accessed directly | |
if( ! defined( 'ABSPATH' ) ) { | |
exit; |
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('pewc_number_field_input_type', 'range_number_field_input_type', 10, 3); | |
function range_number_field_input_type($input_type, $product_id, $item) | |
{ | |
// Check if the enable_range_slider is set to 'checked' | |
$enable_range_slider = isset( $item['enable_range_slider'] ) ? $item['enable_range_slider'] : ''; | |
if ($enable_range_slider == '1') { |
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 a custom checkbox parameter to number field settings | |
*/ | |
function pew_custom_checkbox_param( $group_key, $item_key, $item, $post_id ) { | |
$field_type = isset( $item['field_type'] ) ? $item['field_type'] : ''; | |
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 | |
/** | |
* Allow HTML content in field description | |
*/ | |
function prefix_html_in_description( $description, $item, $additional_info='' ) { | |
$field_description = ! empty( $item['field_description'] ) ? $item['field_description'] : ''; | |
// Allow HTML content in the field description | |
$allowed_tags = wp_kses_allowed_html( 'post' ); | |
$field_description = wp_kses( $field_description, $allowed_tags ); |
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 products restricted by WooCommerce Members Only from FiboSearch results | |
*/ | |
function wcmo_fibosearch_remove_restricted_products( $products ) { | |
if ( ! empty( $products ) ) { | |
$tmp = array(); | |
foreach ( $products as $product ) { | |
if ( ! wcmo_is_product_restricted( $product->ID ) ) { | |
$tmp[] = $product; |
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_tier_min_step', function( $step ) { return '0.01'; }); | |
add_filter( 'wcfad_tier_max_step', function( $step ) { return '0.01'; }); |
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_action( 'wp_footer', function() { | |
?> | |
<script> | |
jQuery(document).ready(function($) { | |
let apc = $('.apaou-customer-fields').find('.apaou-color-field').get(0); | |
// Specify your color palettes here | |
let colorPalettes = ['#000', '#000', '#000', '#fff', '#ff0']; |
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 | |
/** | |
* Exclude add-ons cost in coupon discounts | |
* @return discount amount | |
*/ | |
add_filter( 'woocommerce_coupon_get_discount_amount', function( $amount, $discounting_amount, $cart_item, $single, $coupon ) { | |
$apply_coupon = array( '1097_1772' ); // GroupId_FieldId | |
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 | |
// Editable child quantity in cart when set to independent | |
add_filter('pewc_disable_child_quantities', '__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_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; | |
} |
NewerOlder