Site logo

Archived topic

Hello, i need help with - Display cart panel on add to cart.

17 replies · Started by Alon on October 21, 2022

Viewing posts 1–15 of 18

I have RTL woocommerce website and everything looks great except "Display cart panel on add to cart".
When a user add product to cart the cart panel is not RTL and in english (everything else is RTL and in my language).
How can i change that?
Thank you in advance.

Hi Alon,

Would you like this layout?
https://www.screencast.com/t/HTvEGm7MX

If so, can you try adding this CSS?

.rtl .add-to-cart-panel .continue-shopping {
    margin-left: auto;
    margin-right: unset;
}

.rtl .add-to-cart-panel .cart-info {
    margin-right: unset;
    margin-left: 20px;
}

Let me know!

Thank you for your reply.
Now... How can i change the text to my language without plugin (loco translate).
I'll be really happy if you can help me with this one.

Now… How can i change the text to my language without plugin (loco translate).

It should be translated by default, is your site a multi language site?

What's the site default language set at settings > general > Site Language?

Can I take a look at your site? Let me know!

My site default language is Hebrew.
Everything in my site translated flawlessly except this cart panel.

Can you switch to a twenty twenty theme to see if the translation is correct there?

I have no idea how to do this.
I can't find any cart panel in twenty twenty theme.

Oops my bad, the function doesn't exist in twenty twenty themes.

Can you translate below English words to Hebrew so I can write the function using the Hebrew words?

- Checkout
- Continue shopping
- Item added to cart

Let me know!

Checkout - לתשלום בקופה
Continue shopping - המשך קניות
Item added to cart - פריט נוסף לסל קניות
Item - פריט
Items - פריטים

Thank you so much.

Hi there,

try this PHP snippet:


function cart_panel_text_strings( $translated_text, $text, $domain ) {
    switch ( $translated_text ) {
        case 'Checkout' :
            $translated_text = 'לתשלום בקופה';
            break;
        case 'Continue shopping' :
            $translated_text = 'המשך קניות';
            break;
        case ' Item added to cart. ' :
            $translated_text = 'פריט נוסף לסל קניות';
            break;
        case 'Item' :
            $translated_text = 'פריט';
            break;
        case 'Items' :
            $translated_text = 'פריטים';
            break;
    }
    return $translated_text;
}
add_filter( 'gettext', 'cart_panel_text_strings', 20, 3 );

Thank you for your help.
The code translate just the first one - לתשלום בקופה.
The others still in Eng.

I made a slight change to my code above, can you try that.
If its correct then the Item added to cart. should change.
Let me know.

Hello David.
It doesn't work.
It looks to me exactly as the code before.

This archived topic is closed to new replies.