Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1478610

    Hi team,

    Need some quick help with my site here: https://www.bonjiglass.com/shop/

    The shop categories are currently in alphabetical order, which overall I like, but I would like the Sale one to be at the top and in Bold, so people can see it first. Outside of Sales being on top, the rest being in alphabetical order is fine. Please see: https://imgur.com/a/GIq4Doo

    Also, there used to be a setting where product images would have banners when they were on sale. I used to have everything on sale, so I disabled it, but now want to turn it back on. I don’t remember if its a setting (i cant find one), or if I killed it with CSS display: none (also can’t find).

    Thank you so much for all your help.

    #1478636

    Hey Dzimnikov,

    Thank you for the inquiry.

    We added this script in the functions.php file to relocate the last item in the category list:

    function ava_custom_script_sale_cat()
    { ?>
        <script>
            document.addEventListener("DOMContentLoaded", function() {
    			const list = document.querySelector(".woof_list");
    
    			if (list && list.children.length > 1) {
    				const lastItem = list.lastElementChild;
    				if (lastItem.tagName.toLowerCase() === 'li') {
    					list.prepend(lastItem);
    				}
    			}
    		});
        </script>
        <?php
    }
    add_action('wp_footer', 'ava_custom_script_sale_cat', 99);

    There might be a slight delay in the script execution.

    Best regards,
    Ismael

    #1478692

    Thank you so much. Is there a way to make it bold?

    Also, for my other question, is there a way to bring back those sales banners?

    #1478717

    Hi,

    The text is already bold, but you can try this css code to make it blacker.

    .woof li.woof_term_116  .woof_checkbox_label {
        color: black !important;
    }

    How did you enable the sale banner before, and where did you place it? Are you referring to the “sale! badge”?

    View post on imgur.com

    Best regards,
    Ismael

    #1479111

    The CSS worked, thank you.

    And no, it was more like this:

    View post on imgur.com

    Where I drew in the electric green. They would be like banners hanging over the product photos. Something like that. I pretty sure the store defaults to them, but I somehow turned them off, and I can’t find how at all.

    Thank you so so much

    #1479112

    Also, just realized something. The Sale thing category shows up at the top on desktop, but not on mobile for some reason. Not sure why.

    #1479127

    Hi,

    Try to add this code in the functions.php file to add a custom sales badge above the product image.

    add_filter('woocommerce_sale_flash', 'avf_woocommerce_sale_badge', 10, 3);
    function avf_woocommerce_sale_badge($badge, $post, $product) {
        if ($product->is_on_sale()) {
            return '<span class="av-custom-sale-badge">Sale!</span>';
        }
        return $badge;
    }
    

    Then apply this css code:

    .av-custom-sale-badge {
        position: absolute;
        top: 10px;
        left: 10px;
        background: #7E9A47;
        color: white;
        padding: 5px 10px;
        font-size: 14px;
        font-weight: bold;
        border-radius: 5px;
        z-index: 10;
    }

    Best regards,
    Ismael

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.