This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Issue with product prices in the live search dropdown result

Issue with product prices in the live search dropdown result

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Issue with product prices in the live search dropdown result

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #57662
    Mohamed SalahMohamed Salah
    Participant

    Hello Ajax Search Pro Support Team,

    I have just bought your plugin and its amazing, However my WooCommerce website is an Arabic (RTL) WooCommerce store, and I am facing an issue with how the product prices are displayed in the live search dropdown results.

    The Issue:
    The price numbers, decimals, and the currency symbol (EGP) are overlapping and displaying in a scrambled/reversed order (e.g., 00.EGP18500. instead of EGP 18,500.00).

    The Root Cause:
    I have a custom WooCommerce price format (using tags like <span>, <sup>, <small> to shrink decimals), and WooCommerce naturally uses the <bdi> tag to isolate the price direction in RTL languages.
    Thats it:

    <code class="language-php">add_filter( 'formatted_woocommerce_price', 'sebakashop_span_decimals', 10, 5 );
    function sebakashop_span_decimals( $formatted_price, $price, $decimal_places, $decimal_separator, $thousand_separator ) {
        
        $price = round( $price, $decimal_places );
        
        $whole = number_format( floor( $price ), 0, $decimal_separator, $thousand_separator );
        
        $decimal_value = round( ( $price - floor( $price ) ) * pow( 10, $decimal_places ) );
        $decimal = str_pad( $decimal_value, $decimal_places, '0', STR_PAD_LEFT );
        
        return $whole . '<span class="price-decimals">' . $decimal_separator . $decimal . '</span>';
    }
    

    It seems that the plugin is either stripping these essential HTML tags or stripping their inline attributes (like dir="rtl" or style), which breaks the text direction and the custom formatting completely.

    What I have tried so far (without success):

    1. Enabled “Get product price HTML directly” / “Use WooCommerce price HTML”.

    2. Added <abbr><b><span><bdi><small><sup> to the “HTML Tags exclude from stripping content” field.

    3. Tried wrapping the {Price} tag in the “Advanced Description Field” with <span dir="rtl"> and <abbr>, but the formatting is still broken.

    I have attached screenshots showing the scrambled price in the dropdown, as well as my current backend settings.

    Could you please advise on how to force the plugin to completely render the native WooCommerce price HTML (including all tags and attributes) without any stripping, so it matches the rest of the shop?

    Thank you,

    #57663
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi!

    Thank you for all the details, it helps a lot.

    The output is correct, the issue is that the text direction and alignment on the price is rtl/right, which causes the flip of the elements. This custom CSS will resolve it:

    .rtl .asp_r .price {
        * {
         direction: ltr !important;
         text-align: left !important;       
        }
        del {
         margin-left: 0.7em;
        }
    }

    All the best,
    Ernest

    #57665
    Mohamed SalahMohamed Salah
    Participant

    Thank you, its fixed.

    #57666
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.