• Resolved bitfenix

    (@bitfenix)


    Hi,

    I have to add new css style in the invoice when the product quantity is bigger than 5. In my premium plugin version I have filter which I can use for quantity:

    add_filter('wf_pklist_alter_item_quantiy', 'wt_pklist_item_qty', 10, 5);
    
    function wt_pklist_item_qty($order_item_qty, $template_type, $_product, $order_item, $order) {
    
    	/* custom code */
    	return $order_item_qty;
    }

    This would need to go in the loop since I need to alter cell only where quantity is bigger than 5 and not the others when qty is smaller

    add_filter('wf_pklist_alter_item_quantiy', 'wt_pklist_item_qty', 10, 5);
    
    function wt_pklist_item_qty($order_item_qty, $template_type, $_product, $order_item, $order) {
    
    	if ($order_item_qty > 5) {
    		foreach ($something as $somethings) {
    			$order_item_qty .= '<style> .quantity_td { color: #blue; font-size: 29px; } </style>';
    		}
    	}
    
    	return $order_item_qty;
    }

    If my approach is correct could you help with the foreach loop part?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support WebToffee Support

    (@webtoffeesupport)

    Hi @bitfenix,

    Thanks for reaching out.

    We have modified the code snippet to achieve your requirement. You may please use the below-mentioned code and check.

    add_filter('wf_pklist_alter_item_quantiy', 'wt_pklist_item_qty', 12, 5);
    function wt_pklist_item_qty($order_item_qty, $template_type, $_product, $order_item, $order) {
    	if(isset($order_item['qty']) && $order_item['qty'] > 5){
     		$order_item_qty = '<span style="color:blue; font-size: 29px;">'.$order_item_qty.'</span>';
    	}
    	return $order_item_qty;
    }
    Thread Starter bitfenix

    (@bitfenix)

    That’s it, thank you very much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘order_item_qty in the loop’ is closed to new replies.