• Resolved Brett Ransley

    (@embednz)


    Hello,

    On my woocommerce template, we have altered the “sales-flash.php” under woocommerce/loop directory in the template, and instead of just echoing out “Sale” we calculate a discount as follows:

    
    $sale_price    = $product->get_sale_price();
    $regular_price = $product->get_regular_price();
    $diff = $regular_price-$sale_price;
    $discount = ($diff/$regular_price) * 100;
    

    This gives us a percentage discount.

    When we use the Woo Discount Rules, the “sales price” is only pulling the product discount. but the front end is reflecting the discounted price.

    So for example:

    Product has a price of $300, with a sales price of $200 this means our calculation will display a 33% discount instead of the words “sale” on the sales flash.

    When we use Woo Discount Rule of 50% over the category, the price HTML displays sales price of $150, regular price of $300. but the discount still reflects 33% (because the $product->get_sales_price(); is still returning $200 instead of the discount rules price.

    Is there ANY way I can either pull the discount rule 50%, or the price discount $150 echoed out under price HTML??

    Appreciate any help I can get.

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

    (@sangeethasrinivasan)

    Hi
    Thanks for reaching out.

    We would like to let you know that our plugin does not update the prices in the backend (Sale price for discounts).
    Our plugin applies discount on the fly dynamically while adding the product to cart. However, it doesn’t change the price in the back-end.

    To get discount of a product, you can give a try using this snippet.
    https://gist.github.com/AshlinRejo/c37a155a42c0e30beafbbad183f0c4e8
    ​​
    Hope this helps!

    Thanks
    Team Flycart

    Hi Brett,

    Sorry to reply to an old thread however, I am faced with the same issue and was just wondering if/how you managed to resolve it?

    Many Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get the Discount rule/price from Woocommerce Template’ is closed to new replies.