• Resolved zmoton

    (@zmoton)


    Hi,

    My name is Santiago and I am writing to you because I am having problems with the Dynamic Pricing and Discount Rules plugin for WooCommerce.

    We need to show discount percentage and save money. Now we are using this code in function.php file but it is not working. I share a screen shot :

    Code:
    add_filter( ‘woocommerce_format_sale_price’, function($price, $regular_price, $sale_price ){
    if(!is_float($regular_price) ) $regular_price = floatval($regular_price);
    if(!is_float($sale_price) ) $sale_price = floatval($sale_price);
    if(!$regular_price) return $price;
    $precision = 1;
    $saving_price = wc_price($regular_price – $sale_price );
    $saving_percentage = round( 100 – ( (float)$sale_price / (float)$regular_price * 100 ), 1 ) . ‘%’;
    $price .= sprintf( __(‘<br><small><span class=”snippet-dto-ahorro”>Ahorras:</span> <span class=”snippet-dto-precio”>%s</span> <span class=”snippet-dto-porcentaje”>(%s)</span></small>’, ‘woocommerce’ ), $saving_price, $saving_percentage );
    return $price;
    },10,3);

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author AsanaPlugins

    (@asanaplugins)

    Hi @zmoton

    Thank you for using our plugin.

    We apologize for the inconvenience.

    You can check the “get_price_html” method at the below file. It has filters and you can use it to change the discounted price.

    \wp-content\plugins\easy-woocommerce-discounts\public\class-wccs-public-product-pricing.php

    Also, the plugin has a feature to show percentage discount in a sale badge.

    In order to use this feature please follow the below instructions.

    • Go to the plugin settings – General tab – Product Pricing section.
    • Make sure “Show Sale Badge” is enabled for “Simple” pricing rules.
    • Set “Sale Badge Type” to “Discount”.
    • You can use “Sale Badge Position On Archive Page” to set the position of the sale badge on archive pages.
    • You can use “Sale Badge Position On Product Page” to set the position of the sale badge on the product page.
    • If the sale badge does not appear after trying all of the listed positions for archive and single product page positions you can use the below shortcode to show the sale badge.
      [wccs_sale_flash]

    I hope it helps.

    Best Regards

    Thread Starter zmoton

    (@zmoton)

    Hi,
    Thanks for your answer.

    But I don’t understand how to do it.

    I need help modifying the code I shared above so it works with your plugin.

    You can help me with that?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Need Help With Discount Rules and Dynamic Pricing Plugin’ is closed to new replies.