public function onApplicationEvent(\FS\Context\ApplicationEventInterface $event, \FS\Context\ConfigurableApplicationContextInterface $context) { $methods = $event->getInputs(); $settings = $context->getComponent('\\FS\\Components\\Settings'); $id = $settings['FLAGSHIP_SHIPPING_PLUGIN_ID']; if (\version_compare(WC()->version, '2.6', '>=')) { $methods[$id] = '\\FS\\Configurations\\WordPress\\Shipping\\Method\\FlagShipWcShippingMethod'; } else { include_once FLAGSHIP_SHIPPING_PLUGIN_DIR . 'src/Configurations/WordPress/Shipping/Method/Legacy_Flagship_WC_Shipping_Method.php'; $methods[$id] = new \FlagShip_WC_Shipping_Method(); } return $methods; }
public function onApplicationEvent(\FS\Context\ApplicationEventInterface $event, \FS\Context\ConfigurableApplicationContextInterface $context) { $type = $event->getInput('type'); $postIds = $event->getInputs('postIds'); $pickup = $context->getComponent('\\FS\\Components\\Order\\Pickup'); switch ($type) { case 'schedule': $pickup->schedulePickup($pickup->makeShoppingOrders($postIds)); break; case 'void': $pickup->voidPickup($postIds); break; case 'reschedule': $pickup->reschedulePickup($postIds); break; } }