# fluent-cart/1.6.4/app/Services/PrintService.php

FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler, version 1.6.4. 64 lines.

- Page: https://pluginprobe.com/plugins/fluent-cart/1.6.4/code/app/Services/PrintService.php
- Raw: https://pluginprobe.com/plugins/fluent-cart/1.6.4/raw/app/Services/PrintService.php
- Modified: 2025-10-14T16:36:46+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/fluent-cart/1.6.4/code/app/Services/PrintService.php#L10-L20`.

```php
<?php

namespace FluentCart\App\Services;

use FluentCart\Api\Resource\OrderResource;
use FluentCart\App\Models\Meta;
use FluentCart\App\Services\ShortCodeParser\ShortcodeTemplateBuilder;
use FluentCart\Framework\Support\Arr;
use FluentCart\Framework\Support\Str;

class PrintService
{
    public static function invoice($order)
    {
        return static::print('invoice_template', $order);
    }

    public static function packingSlip($order)
    {
        return static::print('packing_slip', $order);
    }

    public static function deliverySlip($order)
    {
        return static::print('delivery_slip', $order);
    }

    public static function shippingSlip($order)
    {
        return static::print('shipping_slip', $order);
    }

    public static function dispatchSlip($order)
    {
        return static::print('dispatch_slip', $order);
    }

    public static function print($key, $orderId)
    {
        $template = Meta::query()->where('meta_key', $key)->first();
        if ($template) {
            $template = $template->meta_value;
        } else {
            $template = TemplateService::getInvoicePackingTemplateByPathName($key);
        }
        $order = OrderResource::view($orderId)['order'];

        $renderedTemplate = ShortcodeTemplateBuilder::make($template ?? '', [
            'order' => $order
        ]);

        if (has_action('fluent_pdf_download')) {
            do_action('fluent_pdf_download', [
                'body' => $renderedTemplate,
            ],
                Str::of($key)->headline() . '-InvoiceNO-' . Arr::get($order, 'order.invoice_no')
            );
            die();
        }
        return FrontendView::renderForPrint($renderedTemplate);
    }

}

```
