Restrict Coupons by Shipping Methods

add_filter( ‘woocommerce_coupon_is_valid’, function( $valid, $coupon, $discount ) { // List the coupon codes to restrict (lowercase) $restricted_coupons = [ ‘your-coupon-code’ ]; if ( ! in_array( strtolower( $coupon->get_code() ), $restricted_coupons, true ) ) { return $valid; } // Allowed shipping method…Continue reading

Custom Restriction: Category-Specific Subtotal

add_filter( ‘woocommerce_coupon_is_valid’, ‘custom_category_subtotal_coupon_gate’, 20, 2 ); function custom_category_subtotal_coupon_gate( $valid, $coupon ) { $target_coupon = ‘your-coupon-code’; // lowercase coupon code $threshold = 5000.00; $category_ids = array( 12, 34 ); // replace with actual product category IDs if ( strtolower( $coupon->get_code() )…Continue reading

Untitled Snippet

Lyfetyle — Honor Their Story Forever *,*::before,*::after{box-sizing:border-box;margin:0;padding:0} :root{ –ink:#1c1917; –warm:#f9f6f1; –gold:#b8973a; –gold2:#d4aa4a; –slate:#4a4540; –pale:#e8e2d9; –white:#ffffff; } html{scroll-behavior:smooth} body{font-family:’Inter’,sans-serif;background:var(–warm);color:var(–ink);overflow-x:hidden} /* ── NAV ── */ nav{ position:fixed;top:0;left:0;right:0;z-index:200; padding:1.2rem 5vw; display:flex;align-items:center;justify-content:space-between; background:rgba(249,246,241,0.95);backdrop-filter:blur(16px); border-bottom:1px solid var(–pale); } .logo{ font-family:’Playfair Display’,serif; font-size:1.5rem;font-weight:700;letter-spacing:0.04em; color:var(–ink);text-decoration:none; display:flex;align-items:center; }…Continue reading

WWLC – Sync the Wholesale Lead Data to Klaviyo

add_action( ‘wwlc_action_after_create_wholesale_lead’, function( WP_User $new_lead ) { // Retrieve opt-in meta matching the Custom Field ID configured in WWLC admin $opted_in = get_user_meta( $new_lead->ID, ‘klaviyo_subscribe’, true ); // Check both standard string and checkbox group array formats for the checked…Continue reading

AffiliateWP Network Stats Shortcode

/** * Helper: sum product-only sales (excludes shipping) for one affiliate. * Filters to WooCommerce context so the dataset matches the SALES table. */ function affwp_product_only_sales( $affiliate_id, $status_array ) { $total = 0.0; $referrals = affiliate_wp()->referrals->get_referrals( array( ‘affiliate_id’ => absint(…Continue reading