yireo / Yireo_EmailTester2

Open Software License 3.0
29 stars 8 forks source link

Orders are hard-coded as non-virtual #1

Open lfolco opened 2 years ago

lfolco commented 2 years ago

Is there a particular reason that orders are hard-coded to be non-virtual? In \Yireo\EmailTester2\Model\Mailer\Variable\Order::getVariables(), there is this setting:

$order->setIsVirtual(false);
$order->setData('is_not_virtual', true);

I'm more than happy to submit a PR, but want to make sure there isn't some underlying reason for this.

jissereitsma commented 2 years ago

I have to admit I never really looked into this much. The flags were set just to make sure that the shipping address would popup regardless of what products you added to the order (because in the EmailTester backend you can select an order, but if you also select a product, that product will be combined with the order). But now coming to think of it, the is_virtual and is_not_virtual flag would actually need to be calculated from the used order items.

If you have a PR, then awesome :) Otherwise, we'll leave this open so I can pick up on this as soon as I have free time.