module = $module; } public function register(): void { add_action('dokan_product_edit_after_inventory_variants', [$this, 'render'], 50, 2); add_action('dokan_process_product_meta', [$this, 'save'], 20, 1); } /** * @param mixed $post * @param mixed $post_id */ public function render($post = null, $post_id = 0): void { $post_id = (int) $post_id; if ($post_id <= 0 || get_post_type($post_id) !== 'product' || !$this->module->policy()->currentUserMayAuthor()) { return; } try { $state = $this->module->model()->prepare($post_id, get_post_status($post_id) === 'auto-draft'); } catch (\Throwable $e) { Dokan::debugLog('classic render failed for product ' . $post_id . ': ' . $e->getMessage()); return; } $allowed = (array) $state['allowedFields']; ?>