Important notice: we will respond to all open ticket requests up until November the 1st. After this date, we will be unable to process the ticket requests here on Ticksy.

Okay
  Public Ticket #1337965
Improve sale badge function
Closed

Comments

  • Robert started the conversation

    You have some bugs in your sale badge, If I have a variation product it would not display correctly (on variation, it should simply display 'Sale' ), solution, you should integrate everything into one function you can name it satine_elated_wc_sale

    function satine_elated_woocommerce_sale_badge($product, $price, $sale_price){
            //print_r($sale_price);
            if($price > 0 && $sale_price !== 0 ) {
                return '-' . (100 - round(($sale_price * 100) / $price)) . '%';
            }else if ( !$product->has_child() && $sale_price === 0 ){
                return esc_html__('FREE', 'satine');
            }else{
                return esc_html__('SALE', 'satine');
            }
        }

    the has_child is just there as an example.. but you need to use it I guess.

    original function:

    function satine_elated_woocommerce_sale_percentage($price, $sale_price){
            if($price > 0 ) {
                return '-' . (100 - round(($sale_price * 100) / $price)) . '%';
            }else{
                return esc_html__('SALE', 'satine');
            }
        }
    
  •   Elated replied privately
  • Robert replied

    You need to re-check this issue, simply create a variation product with a sale, and see if you can see the badge correctly on front page, category and tag pages.

    On the front page it shows up, but not in category or tag pages.

    The way it shows up on front page is the following: my regular price is $32, but my sale price is $30. so because this is a variation product and the sale is only on 1 of the variations, the correct way of displaying the badge would be to simply output "Sale". but instead it would just show "-100%". The reason it shows -100% is because he doesn't capture the actual sale price and takes the value from regular price, so he thinks the product is free of charge, aka - 100%..


    Check this issue, it's a bug for sure, oh and I'm a developer myself.

    You should incorporate this into your framework, it would be easier to handle it across all of your themes.

    Robert

  •   Elated replied privately
  • ehpdesigns replied

    Out of curiosity is there a fix for this?  My client is using role-based pricing.  So the average user sees one price/discount but "wholesale" customers see a price that is 2/3 cheaper.  Yet the badge always displays "-100%" for all of the items for wholesale customers (this is for simple and variable products).  If there is a fix for this it would be great.  Even if it just said "Sale" that would be appreciated.

  •  1,845
    Elated replied

    Hello,

    Unfortunately, that feature is not predicted for variable products. Anyhow, we will try to improve that feature in some of our future updates. 

    As we have already mentioned in some of previous reply, we will forward this to our developers.


    The Elated Support Center has been moved to our centralized support platform. 

    Please note that any existing tickets prior to this change will be answered right here on Ticksy, and in due time. 

    If you wish to submit a new support request, for all new inquiries please head on to our Help Center.

    Elated Themes is part of Qode Interactive – the home of 300+ premium WordPress themes.

    Don’t forget to sign up for our newsletter and be the first to find out all the latest news.