• Resolved mineralista

    (@mineralista)


    Hello, first of all, thank you for your plugin!! I′ve variable product in my ecommerce, and they′ve prices with prices “From:”. For example, instead of “20$ – 30$”, the price is shown “From: 20$”. You plugin brokes this feature (made with code in functions.php), and now prices with discounts are shown like “2?0?$? ?-? ?3?0?$? 12$ -18$”. I′d like to show prices like “From 2?0?$ 12$”. How can I do this? Thank you.

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

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

    (@asanaplugins)

    Hi @mineralista

    Thank you for choosing our plugin.

    We apologize for the inconvenience.

    Actully this issue is related to your custom code, because the plugin is using WooCommerce functions to format the price range.

    You can try the below code:

    function asnp_woocommerce_format_price_range( $price, $from, $to ) {
    return sprintf( _x( 'From: %$s', 'Price range: from-to', 'woocommerce' ), is_numeric( $from ) ? wc_price( $from ) : $from );
    }
    add_filter( 'woocommerce_format_price_range','asnp_woocommerce_format_price_range', 100, 3 );

    After adding this code, clear the plugin cached prices by saving one of the rules. It is required.

    Please contact your developer for more information because it is related to your custom code.

    I hope it helps.

    Best Regards

    Thread Starter mineralista

    (@mineralista)

    Hello, thanks for your answer. I′d like to try your code. When I tried, wordpress told me “Uncaught ValueError: Argument number specifier must be greater than zero and less than 2147483647 in … ” referint to line 2 of your code: “return sprintf( _x( ‘From: %$s’, ‘Price range: from-to’, ‘woocommerce’ ), is_numeric( $from ) ? wc_price( $from ) : $from );” . Do you know how can I solve this? Thanks.

    Plugin Author AsanaPlugins

    (@asanaplugins)

    Hello @mineralista

    Lets try the below code.

    function asnp_woocommerce_format_price_range( $price, $from, $to ) {

        return sprintf( _x( ‘From: %s’, ‘Price range: from-to’, ‘woocommerce’ ), is_numeric( $from ) ? wc_price( $from ) : $from );

    }

    add_filter( ‘woocommerce_format_price_range’, ‘asnp_woocommerce_format_price_range’, 100, 3 );

    Please do not forget to clear the cache by saving one of the rules.

    I hope it helps.

    Best Regards

    Thread Starter mineralista

    (@mineralista)

    Hello @asanaplugins, with the last code, wordpress told me “syntax error, unexpected token “%”” refering to first line. You can see details in images here: https://drive.google.com/drive/folders/12qYPgIV3ab0tTGx1QHrs1bRRupUeBBXI?usp=sharing
    Thanks for your help with this problem.

    Plugin Author AsanaPlugins

    (@asanaplugins)

    Hello @mineralista

    We apologize for the inconvenience.

    Try the below code.

    function asnp_woocommerce_format_price_range( $price, $from, $to ) {

        return sprintf( __( ‘From: %s’, ‘woocommerce’ ), is_numeric( $from ) ? wc_price( $from ) : $from );

    }

    add_filter( ‘woocommerce_format_price_range’, ‘asnp_woocommerce_format_price_range’, 100, 3 );

    Best Regards

    Thread Starter mineralista

    (@mineralista)

    Hello?@asanaplugins,?now it′s working! The prices now are shown ike this: “F?r?o?m?:? ?3?0?$? From: 20$”. Do you think is possible to show prices like: “From: 3?0?$? 20$”? Thanks again!

    Thread Starter mineralista

    (@mineralista)

    Hello?@asanaplugins, could you help me with this, please?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Variable product prices with “From:”’ is closed to new replies.