Tiered Affiliate Rates — Per-Group Tier Structures

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

WWPP – Restrict add-to-cart on specific products to a specific wholesale role only

// 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