[Resolved] Hello, i need help with – Display cart panel on add to cart.

Home Forums Support [Resolved] Hello, i need help with – Display cart panel on add to cart.

Home Forums Support Hello, i need help with – Display cart panel on add to cart.

Viewing 3 posts - 16 through 18 (of 18 total)
  • Author
    Posts
  • #2386049
    Ying
    Staff
    Customer Support

    Hi Alon,

    Can you try the below code instead:

    function generatepress_custom_add_to_cart_panel_fragments( $fragments ) {
    	if ( isset( WC()->cart ) ) {
    		$fragments['.add-to-cart-panel .cart-data'] = '<div class="cart-data">' . sprintf( _n( '%d פריט', '%d פריטים', WC()->cart->get_cart_contents_count(), 'gp-premium' ), WC()->cart->get_cart_contents_count() ) . ' - ' .  WC()->cart->get_cart_total() . '</div>';
    	}
    
    	return $fragments;
    }
    
    function cart_panel_text_strings( $translated_text, $text, $domain ) {
    	$domain ='gp-premium';
        switch ( $translated_text ) {
            case 'Checkout' :
                $translated_text = 'לתשלום בקופה';
                break;
            case 'Continue Shopping' :
                $translated_text = 'המשך קניות';
                break;
            case 'Item added to cart.' :
                $translated_text = 'פריט נוסף לסל קניות';
                break;
        }
        return $translated_text;
    }
    add_filter( 'gettext', 'cart_panel_text_strings', 20, 3 );
    add_filter( 'woocommerce_add_to_cart_fragments', 'generatepress_custom_add_to_cart_panel_fragments', 10, 1 );
    

    Let me know if it works 🙂

    #2386120
    Alon

    OOOHHHHHHH GREAT.
    Thank you and David for your great help.
    :O)

    #2386314
    Ying
    Staff
    Customer Support

    You are welcome 🙂

Viewing 3 posts - 16 through 18 (of 18 total)
  • You must be logged in to reply to this topic.