HEX
Server: nginx/1.27.1
System: Linux in-4 5.15.0-131-generic #141-Ubuntu SMP Fri Jan 10 21:18:28 UTC 2025 x86_64
User: ilikadirect (1186)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source
Upload Files
File: /storage/v6964/ilikadirect/public_html/wp-content/plugins/wc-pre-order/includes/Frontend/Cart.php
<?php

namespace SpringDevs\PreOrder\Frontend;

use SpringDevs\PreOrder\Illuminate\Helper;

/**
 * Class Cart
 * @package SpringDevs\PreOrder\Frontend
 */
class Cart
{

    public function __construct()
    {
        add_filter('woocommerce_cart_item_name', [$this, 'change_cart_item_name'], 10, 3);
    }

    public function change_cart_item_name($item_name, $cart_item, $cart_item_key)
    {
        $product = wc_get_product($cart_item['product_id']);
        $has_preorder = Helper::has_preorder($product->get_id());
        if ($has_preorder) {
            $item_name .= '<br /><small>' . __(get_option('preorder_order_item_marker_txt', 'Pre-Order product'), "sdevs_preorder") . '</small>';
            $product_cls = new Product();
            $summery_txt = $product_cls->display_txt($product, false);
            $item_name .= '<br /><small>' . __($summery_txt, "sdevs_preorder") . '</small>';
        }
        return $item_name;
    }
}