Home Forums WoodMart support forum product price not displaying right

product price not displaying right

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #652186

    vt
    Participant

    hello
    i have this format for price https://prnt.sc/Q0UCG-MsE8– but in some products it appears like that https://prnt.sc/aHJoPyje6kmF

    #652350

    Hung Pham
    Keymaster

    Hi vt,

    Thanks for reaching to us.

    The first screenshot is not available, please double check.

    Kind Regards,

    #652540

    vt
    Participant

    hello
    this is the problem https://prnt.sc/NfkTjSkGHAtk

    #652664

    Hung Pham
    Keymaster

    Hi vt,

    Thanks for screenshots, both are look like the same. Do you want to display prices in the same line?

    Kind Regards,

    #652697

    vt
    Participant

    this is how its supposed to be looking like https://prnt.sc/o_2jan583cNq as you can see there is a text there which is missing thats why i showed as the problem https://prnt.sc/NfkTjSkGHAtk

    #652875

    Hung Pham
    Keymaster

    Hi vt,

    Please add this code to the functions.php of the child theme:

    add_filter( 'woocommerce_get_price_html', 'add_prefix_to_regular_price', 10, 2 );
    
    function add_prefix_to_regular_price( $price, $product ) {
        // Define your prefix here
        $prefix = 'Price: ';
    
        // Check if the product is on sale
        if ( $product->is_on_sale() ) {
            // Get the regular and sale prices
            $regular_price = wc_price( $product->get_regular_price() );
            $sale_price = wc_price( $product->get_sale_price() );
    
            $price = '<del>' . $prefix . $regular_price . '</del> <ins>' . $sale_price . '</ins>';
        } else {
            // Product is not on sale, add prefix to the regular price
            $price = $prefix . $price;
        }
    
        return $price;
    }

    Regards,

    #652989

    vt
    Participant

    didnt fix anything you just added one more text called price https://prnt.sc/x2QHb0brsfEH that even destroyed the good products price too https://prnt.sc/PJV8d32s5R-W

    #652994

    vt
    Participant

    this code has been removed ofc since it makes it look so bad the old code was fine it just doesnt seem to work on some products as you saw on all the pics or if you visit the site dnt add any new test or anything just fix that please thank you

    #653074

    Hung Pham
    Keymaster

    Hi vt,

    According to the screenshot, you want to add text before original price? Please confirm me back.

    Regards,

    #653124

    vt
    Participant

    this text text called “Τιμη” https://prnt.sc/mVvePxAytcTd but it doesnt show on all products only in some

    #653281

    Hung Pham
    Keymaster

    Hi vt,

    You can use below CSS:

    .single-product .price > span.amount::before {
      content: "Τιμη ";
      display: inline-block;
      margin-right: 4px;
      color: #333;
      font-weight: 500;
    }

    Regards,

    #653289

    vt
    Participant

    this code has error or a confilt since it wont let me save it https://prnt.sc/KJOx7vN4krS8

    #653359

    Hung Pham
    Keymaster

    Hi vt,

    This is Custom CSS, you need to add it under Theme Settings > Custom CSS > Global CSS.

    Regards,

    #653442

    vt
    Participant

    okay i have replace the old code with this and it works thanks

    #653567

    Hung Pham
    Keymaster

    Hi vt,

    Glad to hear your issue has been resolved. Keep us in mind for future questions and concerns, we’re always here to help!

    Regards,

Viewing 15 posts - 1 through 15 (of 15 total)

The topic ‘product price not displaying right’ is closed to new replies.