/** * 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
add_filter( ‘get_post_metadata’, function( $value, $object_id, $meta_key, $single ) { static $running = false; if ( $running ) { return $value; } $intercepted = array( ‘_mepr_coupons_discount_amount’, ‘_mepr_coupons_discount_type’ ); if ( ! in_array( $meta_key, $intercepted, true ) ) { return $value; }…Continue reading
add_shortcode(‘paramount_site’, function () { ob_start(); ?> PARAMOUNT CONTACT PARTNERS Revenue Appointments Contact Let’s Talk → DTC Retention · Payment Recovery · Reactivation We Don’t RunCall CentersWe Build Revenue Engines. Most companies lose money in the exact place they should be…Continue reading
add_filter( ‘affwp_get_affiliate_rate’, function( $rate, $affiliate_id, $type ) { // Respect individual rates — if the affiliate has one set manually, skip group tiers. $affiliate_rate = affiliate_wp()->affiliates->get_column( ‘rate’, $affiliate_id ); if ( ! empty( $affiliate_rate ) ) { return $rate; }…Continue reading
/** * Customize the Admin “New Order” email subject using Wholesale Prices Premium logic */ add_filter( ‘woocommerce_email_subject_new_order’, function( $subject, $order ) { if ( ! $order ) { return $subject; } // Access the Wholesale Prices Premium global object global…Continue reading
/** * Customize the Admin “New Order” email subject for wholesale customers only */ add_filter( ‘woocommerce_email_subject_new_order’, function( $subject, $order ) { if ( ! $order ) { return $subject; } $customer_id = $order->get_customer_id(); if ( ! $customer_id ) { return…Continue reading
// 1. Make the product unpurchasable for non-doctors add_filter( ‘woocommerce_is_purchasable’, ‘wws_restrict_purchase_for_doctors’, 10, 2 ); function wws_restrict_purchase_for_doctors( $is_purchasable, $product ) { $allowed_role = ‘doctors’; $restricted_category = ‘doctors-only’; $product_id = $product->is_type( ‘variation’ ) ? $product->get_parent_id() : $product->get_id(); if ( has_term( $restricted_category, ‘product_cat’,…Continue reading
/** * Restrict add-to-cart on specific products to the ‘doctors’ wholesale role only. * * Usage: * 1. Set DOCTORS_ROLE_SLUG below to match the wholesale role slug you created in * WooCommerce > Wholesale Roles. * 2. On each product’s…Continue reading