• Resolved hotspotdesign

    (@hotspotdesign)


    Hello,

    It would be very welcome to have the option to have the table cell with the quantity of items be bold or coloured, if the item quantity is more that 1 item.

    Is it possible to achieve this in anyway you know possible?

    Regards, J

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor alexmigf

    (@alexmigf)

    Hello @hotspotdesign

    The easy way is with our Premium Templates extension adding the code snippet below to the customizer custom styles:

    .quantity.multiple { color:red; }

    Alternatively you could add an action hook following this documentation page: Using custom styles

    We set up our own template, added a function to the template-functions.php

    
    function getQuantityColour(int $number)
    {
        if ($number > 1 )
            return 'red;color: white;';
        else if ($number = 1)
            return 'white;color: black;';
    }
    

    Then changed the lines for quantity to check

    
    			<td class="quantity"><span style="background-color: <?php echo getQuantityColour($item['quantity']); ?>">&nbsp;<?php echo $item['quantity']; ?>&nbsp;</span></td>
    

    This sets the background to red with white writing when quantity is more than 1.

    Hope this helps.

    Regards,
    Renners

    Plugin Contributor Ewout

    (@pomegranate)

    Thank you for your contribution @renners, nice work!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘if then styling for quantity’ is closed to new replies.