2

I have a few rules for "Free Shipping", however, the output for the "Method Name" is a general label that doesn't make sense for one of my free shipping options.

Example:

Free Shipping Rule 1: Display "Shipping Courier 1"

Free Shipping Rule 2: Display "Software Virtual License"

Is there a way to change the Free Shipping "Method Name" based on a rule? If not, what would be the best way to go about this?


EDIT: Since I cannot change these products to a virtual product, is it possible to create an observer on the cart and checkout page that would treat these products with a specific attribute as a virtual product?

How would I create a basic observer to by-pass the shipping?

1
  • Updated my answer according to your edit Commented Dec 20, 2015 at 20:43

1 Answer 1

0
+50

You could try to set up the free shipping rules with table rates where you can define different names.

But "Software Virtual License" looks like a special case. Software licenses should be virtual products and if you have only virtual products in the cart, the shipping step is skipped completely.


Answer to updated question:

Since I cannot change these products to a virtual product, is it possible to create an observer on the cart and checkout page that would treat these products with a specific attribute as a virtual product?

How would I create a basic observer to by-pass the shipping?

The method that's used to determine if a quote is virtual, i.e. the shipping step is skipped, is Mage_Sales_Model_Quote::isVirtual().

You see that the only way to influence the result without rewriting this method would be to make the products getIsVirtual() method return true:

$_item->getProduct()->getIsVirtual())

Unfortunately this method uses the product type singleton instance:

return $this->getTypeInstance(true)->isVirtual($this);

And for simple products, the isVirtual() method simply returns false:

public function isVirtual($product = null)
{
    return false;
}

So, there is no way to modify the behavior with an observer, but you have the choice which model to rewrite:

  • sales/quote
  • catalog/product
  • catalog/product_type_simple

This is something like a choice between pest, cholera and hemorrhoids. Between those, I'd always choose the latter but it's still not nice.

3
  • I agree they should be virtual products, but since they are already simple products I cannot change them so this is the work around. Table rates wont work either because all my shipping calculations are done through my suppliers. A free shipping rule would allow me to create the option that would bypass my supplier since they dont give a response to virtual products on shipping - which in turn does not allow a visitor to checkout for these products.
    – SR_Magento
    Commented Dec 18, 2015 at 11:19
  • @SR_Magento couldn't you change the product type in the DB > "catalog_product_entity" from simple to virtual?
    – dawhoo
    Commented Dec 18, 2015 at 21:08
  • @dawhoo it would work but we are talking a couple of thousand products and wouldnt address the new ones that are brought in regularly.
    – SR_Magento
    Commented Dec 20, 2015 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.