Override Wholesale Price Text Per Wholesale Role

add_filter(‘wwp_filter_wholesale_price_title_text’, ‘wholesale_price_text’, 10, 1); function wholesale_price_text($text) { global $wc_wholesale_prices; $user_wholesale_role = $wc_wholesale_prices->wwp_wholesale_roles->getUserWholesaleRole(); if (!empty($user_wholesale_role)) { // To Switch wholesale price text depending on wholesale role switch ($user_wholesale_role[0]) { case ‘wholesale_customer’: return ‘Wholesale Price:’; // Add more role keys case ‘wholesale_bronze’:…Continue reading

Prevent Wholesale Customer to Add Product to the Cart If The Product is Low on Stock

// Prevent wholesale customer to add to cart if the product is low on stock add_filter(‘woocommerce_is_purchasable’, ‘wwpp_disable_cart_lowstock’, 10, 2 ); add_filter(‘woocommerce_variation_is_purchasable’, ‘wwpp_disable_cart_lowstock’, 10, 2 ); function wwpp_disable_cart_lowstock( $purchasable, $product ) { global $wc_wholesale_prices_premium; $user_wholesale_role = $wc_wholesale_prices_premium->wwpp_wholesale_roles->getUserWholesaleRole(); if( !empty( $user_wholesale_role )…Continue reading

MemberPress: Only Allow Coupon Once Per User

function custom_validate_coupon( $errors ) { global $wpdb; //If user is not logged in, then they’ve never used a coupon before if( !MeprUtils::is_user_logged_in() ) { return $errors; } $coupon_code = ( isset( $_POST[‘mepr_coupon_code’] ) && !empty( $_POST[‘mepr_coupon_code’] ) )?stripslashes( $_POST[‘mepr_coupon_code’] ):”;…Continue reading

quiz

// setup console.log(“running”); let q = 1; const submit = document.getElementById(“next-button”); const question = document.getElementById(“question”); // next button document.getElementById(“next-button”).addEventListener(“click”, function () { // split by q value let radioButtons = document.querySelectorAll(“input[name=’yes-no’]”); if (q == 4) { radioButtons = document.querySelectorAll(“input[name=’time-choice’]”); }…Continue reading

Untitled Snippet

add_filter( ‘aioseo_robots_meta’, ‘aioseo_filter_robots_meta’ ); function aioseo_filter_robots_meta( $attributes ) { $url = home_url( $_SERVER[‘REQUEST_URI’] ); if (strpos($url,’product_search=’) !== false) { $attributes[‘index’] = “noindex”; }; return $attributes; }Continue reading

Allow ico Files Upload

/*——————————————— TYPE MIME ICO par HP MC&C ———————————————-*/ function allow_ico_mime_types( $mimes ){ $mimes[‘ico’] = ‘image/x-icon’; return $mimes; } add_filter( ‘upload_mimes’, ‘allow_ico_mime_types’ );Continue reading

MemberPress: Remove State Text Field

function mepr_remove_state_field() { global $post; $mepr_options = MeprOptions::fetch(); $is_product_page = ( false !== ( $prd = MeprProduct::is_product_page($post) ) ); if( $mepr_options->global_styles || $is_product_page ) { ?>Continue reading