I’m using the Shopp plugin for WP. We have a custom “member pricing” system written into our functions.php file and I can’t figure out how to restrict this pricing to one of each item. To clarify, if a member adds qty 2 of item A to cart, they should see special pricing for 1 of them and full pricing for the other. Thank you!
Member code is as follows:
/***********************
* SET PRICE BASED ON CLIENT TYPE
************************/
add_action('shopp_cart_add_item', 'my_function');
function my_function ( $Item ) {
global $Shopp, $current_user;
//only override price if we have a client type
if(count($_SESSION['userdata']->ClientTypes) > 0)
{
//check to see if there is a special price for this product
$prices = get_field('client_type_prices', $Item->product);
//reset for each prouct
$setspecial = FALSE;
$setprice = "";
foreach($prices as $price)
{
//get our client type unique id
$unique_id = get_field('unique_id', $price['client_type']->ID);
if(in_array($unique_id, $_SESSION['clienttypes']))
{
if(($price['price'] < $setprice) || ($setprice == "")){
$setprice = $price['price'];
$setspecial = TRUE;
}
}
}
//only actually override the price if a modified price has been entered for the item/type
if($setspecial)
{
$Item->unitprice = $setprice;
$Item->data->priced = $setprice;
}
}
return $Item;
}