*/ private static $rules = null; public static function init() { global $post, $theorder; if (!$post && !$theorder) { return; } $orderRepository = new OrderRepository(); self::$rules = $orderRepository->getAppliedRulesForOrder($post->ID ?? $theorder->get_id()); if ( ! empty(self::$rules)) { add_meta_box( 'wdp-order-applied-rules', __('Applied discounts', 'advanced-dynamic-pricing-for-woocommerce'), array(__CLASS__, 'output'), adp_context()->isHPOSEnabled() ? wc_get_page_screen_id('shop-order') : 'shop_order', 'side', 'core' ); } } /** * Output the metaBox. * * @param WP_Post $post */ public static function output($post) { $context = new Context(); $rules = self::$rules; ?>
| %s', self::ruleUrl($rule), $rule->title) : ""; ?> |