CSS snippet for checkbox and label alignment
add_action(‘wp_footer’, function () { ?>Continue reading
Join 2,000,000+ Professionals who use WPCode to Future-Proof Their Websites!
add_action(‘wp_footer’, function () { ?>Continue reading
add_filter( ‘woocommerce_coupon_message’, ‘hide_coupon_success_message’, 10, 3 ); function hide_coupon_success_message( $msg, $msg_code, $coupon ) { if ( $msg_code === 200 ) { // 200 is the code for a successful coupon application return ”; // Return an empty string to hide the…Continue reading
add_filter(‘woocommerce_coupon_is_valid’, ‘block_employee_coupon_usage’, 10, 3); function block_employee_coupon_usage($valid, $coupon, $discount) { if (is_user_logged_in()) { $user = wp_get_current_user(); if (in_array(’employee’, (array) $user->roles) || in_array(‘owner’, (array) $user->roles)) { wc_add_notice(__(‘Employees are not allowed to use coupons.’, ‘woocommerce’), ‘error’); return false; } } return $valid; }Continue reading
/** * Handle Meta (Facebook/Instagram Shops) checkout URLs * Format: /checkout?products=wc_post_id_123:2,wc_post_id_456:1&coupon=CODE */ add_action( ‘template_redirect’, function() { if ( ! isset( $_GET[‘products’] ) ) { return; } // Ensure WooCommerce is loaded and cart is available if ( ! function_exists( ‘WC’…Continue reading
/** * WooCommerce: cookie-driven auto-coupon using the coupon’s own restrictions * – URL: ?bllpromo=COUPONCODE -> sets cookie bllpromo=COUPONCODE for 30 days * – If cookie exists and coupon is valid for the current cart (per ALL restrictions), * the coupon…Continue reading
add_filter( ‘woocommerce_coupon_message’, function( $msg, $msg_code, $coupon ) { if ( $msg_code === ‘coupon_already_applied’ ) { return ”; // hide the message } return $msg; }, 10, 3 );Continue reading
add_filter( ‘woocommerce_get_availability_text’, ‘wsp_custom_coming_soon_text’, 10, 2 ); function wsp_custom_coming_soon_text( $text, $product ) { if ( ! $product ) { return $text; } // Get the correct product ID (parent for variations) $product_id = $product->get_id(); if ( $product->is_type( ‘variation’ ) ) {…Continue reading
add_action(‘age_gate/custom/after’, ‘my_custom_fields’); function my_custom_fields() { echo ‘ I agree and understand that certain products on this site are intended for research use only, as defined by the FDA. I also agree to the Research Use Only Policy of this site.‘;…Continue reading
function edd_library_variable_price_dropdown() { function shoestrap_edd_purchase_variable_pricing( $download_id ) { $variable_pricing = edd_has_variable_prices( $download_id ); if ( ! $variable_pricing ) return; $prices = apply_filters( ‘edd_purchase_variable_prices’, edd_get_variable_prices( $download_id ), $download_id ); $type = edd_single_price_option_mode( $download_id ) ? ‘checkbox’ : ‘radio’; do_action( ‘edd_before_price_options’, $download_id…Continue reading