• Resolved desertarmorshop

    (@desertarmorshop)


    Had this working before via WooCommerce Sales Flash Pro. Either this or the Sales Flash Pro updated and it no longer work unless I deactivate The Plus Addons for Elementor Page Builder & The Plus Addons for Elementor Page Builder Lite. I have deleted Sales flash pro completely.

    Any suggestions on how to alter the sales flash from displaying the $ amount off vs the % off?

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter desertarmorshop

    (@desertarmorshop)

    Thread Starter desertarmorshop

    (@desertarmorshop)

    JUST NEED ADVICE ON HOW TO CHANGE SALES FLASH FROM % OFF TO $ AMOUNT OFF

    Plugin Contributor Ankit Patel

    (@ankitposimyth)

    @desertarmorshop

    Please take a look https://www.loom.com/share/f138c669ab554e23b62fbdf8d9839090

    You can overwrite by woocommerce_sale_flash add filter, You need to put below code in Theme’s function file.

    /*woo sale amount*/
    if(class_exists(‘woocommerce’)) {
    function plus_filter_woocommerce_sale_flash_amount( $output_html, $post, $product ) {
    if ($product->get_type() == ‘variable’) {
    $available_variations = $product->get_available_variations();
    $maximumper = 0;
    for ($i = 0; $i < count($available_variations); ++$i) {
    $variation_id=$available_variations[$i][‘variation_id’];
    $variable_product1= new WC_Product_Variation( $variation_id );
    $regular_price = $variable_product1->get_regular_price();
    $sales_price = $variable_product1->get_sale_price();
    $percentage = $sales_price ? round($regular_price – $sales_price ) : 0;
    if ($percentage > $maximumper) {
    $maximumper = $percentage;
    }
    }
    $output_html = ‘<span class=”badge onsale perc”>↓ ‘.$maximumper.’$</span>’;
    } else if ($product->get_type() == ‘simple’){
    $percentage = round( $product->get_regular_price() – $product->get_sale_price());
    $output_html = ‘<span class=”badge onsale perc”>↓ ‘.$percentage.’$</span>’;
    } else if ($product->get_type() == ‘external’){
    $percentage = round($product->get_regular_price() – $product->get_sale_price());
    $output_html = ‘<span class=”badge onsale perc”>↓ ‘.$percentage.’$</span>’;
    }else {
    $output_html = ‘<span class=”badge onsale”>’.esc_html__( ‘Sale’,’theplus’ ).'</span>’;
    }
    return $output_html;
    };

    add_filter( ‘woocommerce_sale_flash’, ‘plus_filter_woocommerce_sale_flash_amount’, 11, 3 );
    }

    Thread Starter desertarmorshop

    (@desertarmorshop)

    Code provide above does not work…….

    Got this error:

    “Your PHP code changes were rolled back due to an error on line 94 of file wp-content/themes/neve/functions.php. Please fix and try saving again.

    syntax error, unexpected ‘–’ (T_CLASS)”

    PLEASE ADVISE ASAP

    Thread Starter desertarmorshop

    (@desertarmorshop)

    My PHP version on my server is 7.4

    Plugin Author POSIMYTH

    (@posimyththemes)

    Hello @desertarmorshop

    We hope you have got a solution on this.

    We are making this ticket resolved, Still, If you need any help, You may reopen this or submit new ticket. We are always happy to help you.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to change sales flash from Percent to Amount’ is closed to new replies.