Free Shipping option for product category if it's the only one in the cart (flat rate cart)
I dug through the forums but couldn't piece together what I needed.
The cart that I've setup is flat rate shipping for the whole cart with a drop down to pick between store pickup (free), domestic, domestic express international, and international express, so no weights are used. Now we have added gift cards to the store. The gift cards are in their own category (from a relational table). I've bound the category ID to the WA eCart AddToCart. The gift cards will be emailed so they need to be free shipping if gift cards are the only products in the cart.
The current shipping rules use session variables set from the shipping option drop down menu in the cart. I created a new rule for the gift cards using the trigger condition "Number of items with a specific column value" where Category of 52 (the category ID for gift cards) is > 0. It seems that I now need to add another trigger that checks the cart for any items that are not from Category 52 so it will use the other shipping rules and not make the whole cart free shipping. I haven't been able to figure out how to do this.
Thanks for you time!
//eCart Rule
function WAEC_yoCart_USPS() {
$totalShipping = 0;
if (true && (((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "US") && ((isset($_SESSION['eCartCheckoutForm_shipping_method'])?$_SESSION['eCartCheckoutForm_shipping_method']:"") == "Standard"))) {
$totalShipping += 6;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_yoCart_DomesticExpress() {
$totalShipping = 0;
if (true && (((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "US") && ((isset($_SESSION['eCartCheckoutForm_shipping_method'])?$_SESSION['eCartCheckoutForm_shipping_method']:"") == "Express"))) {
$totalShipping += 50;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_yoCart_International() {
$totalShipping = 0;
if (true && (((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") != "US") && ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") != "") && ((isset($_SESSION['eCartCheckoutForm_shipping_method'])?$_SESSION['eCartCheckoutForm_shipping_method']:"") == "Standard"))) {
$totalShipping += 18;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_yoCart_InternationalExpress() {
$totalShipping = 0;
if (true && (((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") != "US") && ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") != "") && ((isset($_SESSION['eCartCheckoutForm_shipping_method'])?$_SESSION['eCartCheckoutForm_shipping_method']:"") == "Express"))) {
$totalShipping += 50;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_yoCart_EmptyShipping() {
$totalShipping = 0;
if (true && (((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == ""))) {
$totalShipping += 0;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_yoCart_StorePickup() {
$totalShipping = 0;
if (true && (((isset($_SESSION['eCartCheckoutForm_shipping_method'])?$_SESSION['eCartCheckoutForm_shipping_method']:"") == "Store Pickup"))) {
$totalShipping += 0;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_yoCart_GiftCertificate() {
$totalShipping = 0;
if (true && (($this->ConditionalTotal("Quantity", "Category", "52") > 0))) {
$totalShipping += 0;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule