Free shipping, but only for those items in a category? Multiple categories in cart.


  • Default avatar
    greg16    
     9 years ago
    0

    Function: Shipping, Shipping: UPS, Amount or Percent: Percent, Discount Type:Specific, Category:Hammers

    With this coupon, adding items from a different category will cause the coupon to not be applicable. How do I get the discount to apply to only the shipping cost of Hammers?
  • Your avatar
    seyi    
     9 years ago
    0

    Hello,

    You cannot. The shipping discounts the whole shipping or not. It is not really possible to figure out what amount of the shipping cost goes to the hammer without writing some extra logic for the shipping method you are using.

    Also please read how the discount type affects shipping coupon types:
    https://awodev.com/documentation/awocoupon-pro/coupons#discount-type
  • Default avatar
    shopoftoys    
     9 years ago
    0

    We have a similar requirement, we only want the free shipping to be valid if all the products in the cart are contained in the Shipping Coupon "inclusive" products/category list. If any product is in the cart but not in the shipping coupon inclusive list, then we don't want the shipping coupon to be applied at all. Would think this is how most shops would want it implemented.

    Would like to suggest this as a possible enhancement to AwoCoupon Pro.

    thanks
  • Your avatar
    seyi    
     9 years ago
    0

    Hello,

    Yes, you can do that:

    value: 100%
    Discount type: specific
    Under assets: select the products/categories
  • Default avatar
    shopoftoys    
     9 years ago
    0

    Changing to "Specific" didn't seem to change anything for shipping discount. I put discount type as "Specific" but it still provides the shipping discount even when there are other products in the cart that are not in the inclusion list, as long as one of the products is in the inclusion list it provides the discount.
  • Your avatar
    seyi    
     9 years ago
    0

    There is a problem with the current version. This will be fixed on the next release, in the mean time, here is what you can do to fix it:
    in www/administrator/components/com_awocoupon/helpers/estore/estorecouponhandler.php around line 2622 is this:
    <?php
            
    if($coupon_row->function_type=='shipping' && $coupon_row->discount_type=='specific') {
            
                
    $r_err $this->couponvalidate_include_exclude$coupon_row, array(
                        
    'asset_mode'=>'exclude',
                        
    'asset_type'=>$asset_type,
                        
    'valid_list'=>$coupon_row->{$list_name},
                        
    'error_include'=>'errShippingExclList',
                        
    'error_exclude'=>'errShippingExclList',
                    )
                );
                if(!empty(
    $r_err)) return $r_err;
            }
    ?>


    Change it to this
    <?php
            
    if($coupon_row->function_type=='shipping' && $coupon_row->discount_type=='specific') {
                
                
    $r_err '';
                if(empty(
    $coupon_row->params->{$asset_mode_name}) || $coupon_row->params->{$asset_mode_name}=='include') {
                    
    $is_not_in_list false;
                    foreach(
    $coupon_row->cart_items as $row) {
                        if (
                            (
    $asset_type=='product' && !isset($coupon_row->{$list_name}[$row[$asset_id_name]]))
                                        ||
                            (
    $asset_type!='product' && !isset($coupon_row->{$list_name}[@$coupon_row->cart_items_def[$row['product_id']][$asset_type]]))
                        ) {
                            
    $is_not_in_list true;
                            break;
                        }
                    }
                    if(
    $is_not_in_list) {
                    
    // (exclude) all on list
                        
    $r_err 'err'.ucfirst(strtolower($asset_type)).'InclList';
                    }
                }
                elseif(
    $coupon_row->params->{$asset_mode_name}=='exclude') {
                    
    $is_in_list false;
                    foreach(
    $coupon_row->cart_items as $row) {
                        if (
                            (
    $asset_type=='product' && isset($coupon_row->{$list_name}[$row[$asset_id_name]]))
                                        ||
                            (
    $asset_type!='product' && isset($coupon_row->{$list_name}[@$coupon_row->cart_items_def[$row['product_id']][$asset_type]]))
                        ) {
                            
    $is_in_list true;
                            break;
                        }
                    }
                    if(
    $is_in_list) {
                    
    // (exclude) all on list
                        
    $r_err 'err'.ucfirst(strtolower($asset_type)).'ExclList';
                    }
                }
                if(!empty(
    $r_err)) return $r_err;
                
            }
    ?>


    That should do it.
  • Default avatar
    shopoftoys    
     9 years ago
    0

    thanks.. I will try it if I get a chance or might just wait for the next release as it's not urgent... thanks.