/** * Affiliate Welcome Coupon for WooCommerce + SliceWP. * Creates a unique 15% coupon for a newly registered customer * referred by a valid SliceWP affiliate. * * Does not modify affiliate commissions or store credit. */ defined( 'ABSPATH' ) || exit; add_action( 'woocommerce_created_customer', 'awc_create_referred_customer_coupon', 20, 3 ); function awc_create_referred_customer_coupon( $customer_id, $new_customer_data = array(), $password_generated = false ) { if ( ! function_exists( 'slicewp_get_affiliate' ) || ! class_exists( 'WC_Coupon' ) || ! function_exists( 'wc_get_coupon_id_by_code' ) ) { return; } $customer_id = absint( $customer_id ); if ( ! $customer_id ) { return; } // Prevent duplicate coupon generation. if ( get_user_meta( $customer_id, '_awc_welcome_coupon', true ) ) { return; } $customer = get_userdata( $customer_id ); if ( ! $customer || ! is_email( $customer->user_email ) ) { return; } // SliceWP stores the referring affiliate ID in this cookie. $affiliate_id = isset( $_COOKIE['slicewp_aff'] ) ? absint( wp_unslash( $_COOKIE['slicewp_aff'] ) ) : 0; if ( ! $affiliate_id ) { return; } // Validate the affiliate against SliceWP's database. $affiliate = slicewp_get_affiliate( $affiliate_id ); if ( ! $affiliate || ! method_exists( $affiliate, 'get' ) ) { return; } if ( 'active' !== $affiliate->get( 'status' ) ) { return; } // Do not issue a customer welcome coupon to the affiliate themselves. if ( function_exists( 'slicewp_get_affiliate_by_user_id' ) && slicewp_get_affiliate_by_user_id( $customer_id ) ) { return; } // Create a unique, unpredictable coupon code. $coupon_code = ''; for ( $attempt = 0; $attempt < 5; $attempt++ ) { $candidate = 'WELCOME15-' . strtoupper( wp_generate_password( 16, false, false ) ); if ( ! wc_get_coupon_id_by_code( $candidate ) ) { $coupon_code = $candidate; break; } } if ( ! $coupon_code ) { return; } try { $coupon = new WC_Coupon(); $coupon->set_code( $coupon_code ); $coupon->set_discount_type( 'percent' ); $coupon->set_amount( 15 ); // Only one successful use in total. $coupon->set_usage_limit( 1 ); // One use per customer as an additional safeguard. $coupon->set_usage_limit_per_user( 1 ); // Restrict it to the referred customer's email. $coupon->set_email_restrictions( array( sanitize_email( $customer->user_email ) ) ); $coupon->set_individual_use( true ); $coupon->set_description( '15% welcome coupon issued to a SliceWP-referred customer.' ); $coupon_id = $coupon->save(); if ( ! $coupon_id ) { return; } // Save the code against the customer only after coupon creation. update_user_meta( $customer_id, '_awc_welcome_coupon', $coupon_code ); update_user_meta( $customer_id, '_awc_referring_affiliate', $affiliate_id ); } catch ( Throwable $e ) { error_log( 'Affiliate Welcome Coupon: ' . $e->getMessage() ); } } /** * Display the coupon on WooCommerce My Account > Dashboard. */ add_action( 'woocommerce_account_dashboard', 'awc_display_referred_customer_coupon' ); function awc_display_referred_customer_coupon() { if ( ! is_user_logged_in() || ! function_exists( 'wc_get_coupon_id_by_code' ) ) { return; } $customer_id = get_current_user_id(); $coupon_code = get_user_meta( $customer_id, '_awc_welcome_coupon', true ); if ( ! $coupon_code ) { return; } $coupon_id = wc_get_coupon_id_by_code( $coupon_code ); if ( ! $coupon_id ) { return; } $coupon = new WC_Coupon( $coupon_id ); if ( ! $coupon->get_id() || $coupon->get_usage_count() >= 1 || ! $coupon->is_valid() ) { return; } $customer = get_userdata( $customer_id ); if ( ! $customer ) { return; } $allowed_emails = array_map( 'strtolower', $coupon->get_email_restrictions() ); if ( ! in_array( strtolower( $customer->user_email ), $allowed_emails, true ) ) { return; } echo '
'; echo '' . esc_html__( 'Your 15% welcome discount', 'woocommerce' ) . ''; echo '

' . esc_html__( 'Use your personal coupon at checkout:', 'woocommerce' ) . '

'; echo '

' . esc_html( $coupon_code ) . '

'; echo '

' . esc_html__( 'This coupon is restricted to your email address and can be used once.', 'woocommerce' ) . '

'; echo '
'; } BPC-157 – Rizwan https://rizwan.thecreativesbay.com.pk Fri, 17 Jul 2026 14:00:05 +0000 en-US hourly 1 https://wordpress.org/?v=7.1.5 Wolverine Blend — BPC-157 / TB-500 https://rizwan.thecreativesbay.com.pk/product/wolverine-blend-bpc-157-tb-500/ Sun, 05 Jul 2026 14:52:18 +0000 https://rizwan.thecreativesbay.com.pk/?post_type=product&p=155 The Wolverine Blend is a dual-peptide research compound combining BPC-157 (10mg) and Thymosin Beta-4 / TB-500 (10mg) in a single lyophilized vial. Intended for qualified researchers studying multi-peptide interactions and compound stability under controlled laboratory conditions. For research use only.

]]>
GLOW 50 — GHK-Cu / BPC-157 / TB-500 https://rizwan.thecreativesbay.com.pk/product/glow-50-ghk-cu-bpc-157-tb-500/ Fri, 03 Jul 2026 20:47:38 +0000 https://rizwan.thecreativesbay.com.pk/?post_type=product&p=125 GLOW 50 is a multi-peptide research compound combining GHK-Cu (30mg), BPC-157 (10mg), and Thymosin Beta-4 / TB-500 (10mg) in a single lyophilized vial. Intended for qualified researchers studying copper peptide interactions, multi-compound stability, and related biochemical behavior under controlled laboratory conditions. For research use only.

]]>
BPC-157 — 10mg https://rizwan.thecreativesbay.com.pk/product/bpc-157-10mg/ Fri, 03 Jul 2026 19:38:38 +0000 https://rizwan.thecreativesbay.com.pk/?post_type=product&p=110 BPC-157 is a synthetic peptide comprised of 15 amino acids, derived from a protein found in gastric juice. It is used exclusively in laboratory and in vitro research settings. This product is intended for qualified researchers studying peptide behavior, stability, and interactions under controlled experimental conditions. Available in lyophilized form for research use only.

]]>