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 | |
/** | |
* Update cart item notes | |
*/ | |
function prefix_update_cart_notes() { | |
// Do a nonce check | |
if( ! isset( $_POST['security'] ) || ! wp_verify_nonce( $_POST['security'], 'woocommerce-cart' ) ) { | |
wp_send_json( array( 'nonce_fail' => 1 ) ); | |
exit; | |
} |
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 | |
/** | |
* Get the user's roles | |
* @since 1.0.0 | |
*/ | |
function wcmo_get_current_user_roles() { | |
if( is_user_logged_in() ) { | |
$user = wp_get_current_user(); | |
$roles = ( array ) $user->roles; | |
return $roles; // This returns an 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
RewriteCond %{HTTP_HOST} ^olddomain\.com$ [OR] | |
RewriteCond %{HTTP_HOST} ^www\.olddomain\.com$ | |
RewriteRule ^(.*)$ "https\:\/\/newdomain\.com\/$1" [R=301,L] |
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
function bv_wc_ajax_variation_threshold( $qty, $product ) { | |
return 50; | |
} | |
add_filter( 'woocommerce_ajax_variation_threshold', 'bv_wc_ajax_variation_threshold', 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 | |
function pewc_check_order_meta( $product_name, $item ) { | |
if( isset( $item['product_extras']['groups'] ) ) { | |
foreach ( $item['product_extras']['groups'] as $groups ) { | |
if( $groups ) { | |
$product_name .= '<ul>'; | |
foreach( $groups as $group ) { | |
if( isset( $group['type'] ) ) { | |
// if( isset( $group['type'] ) && empty( $group['flat_rate'] ) ) { | |
$classes = array( strtolower( str_replace( ' ', '_', $group['type'] ) ) ); |
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 | |
// Replace HTTP with HTTPS in arrow resource | |
function prefix_filter_cart_remove_linked_product( $arrow_right, $cart_item_key ) { | |
return str_replace( 'http://', 'https://', $arrow_right ); | |
} | |
add_filter( 'pewc_filter_cart_remove_linked_product', 'prefix_filter_cart_remove_linked_product', 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 | |
/** | |
* @param $multiple '' | 'multiple' | |
* @param $product_id Product ID | |
* @param $id Field ID | |
*/ | |
// Enable multiple uploads for all file inputs | |
function prefix_filter_multiple( $multiple, $product_id, $id ) { | |
return 'multiple'; |
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 | |
// Allow zero cost bookings | |
add_filter( 'bfwc_allow_zero_cost_bookings', '__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 | |
/** | |
* Filter flat rate fields to ensure that the same flat rate field can get charged for multiple products | |
*/ | |
function prefix_filter_flat_rate( $label, $id, $flat_rate ) { | |
$label .= $id; | |
return $label; | |
} | |
add_filter( 'pewc_flat_rate_label', 'prefix_filter_flat_rate', 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 | |
/** | |
* A text field template | |
* @since 2.0.0 | |
* @package WooCommerce Product Add-Ons Ultimate | |
* @see https://pluginrepublic.com/documentation/overriding-templates/ for more details | |
*/ | |
// Exit if accessed directly | |
if( ! defined( 'ABSPATH' ) ) { |