New Landing How can we help? Themeforest Theme Support Neighborhood Modify Text in Cart Summary

Viewing 8 posts - 1 through 8 (of 8 total)
  • #265709
    webmgr
    Member
    Post count: 80

    Following your response to a post by LouisaMel at

    Variations on shop page

    I was able to modify the text – “SELECT OPTIONS” and “ADD ITEM TO SHOPPING BAG”, appearing on the product page. I edited
    neighborhood/woocommerce/loop/add-to-cart.php

    I would like to do the same for the text in the cart preview at the top right of the theme. (see image)

    I want to change “items in the shopping bag” and “View shopping bag” to “items in the cart” and “View cart”. Is there a similar file to modify this code? I checked the woocommerce folder but couldn’t find it.

    Thanks very much.
    webmgr

    Attachments:
    You must be logged in to view attached files.
    #265756
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please paste this code at functions.php of child theme and edit the text as you want.

    function sf_woo_header_add_to_cart_fragment( $fragments ) {
    			global $woocommerce;
    
    			ob_start();
    
    			$cart_total = WC()->cart->get_cart_total();
    			$cart_count = $woocommerce->cart->cart_contents_count;
    			$cart_count_text = sf_product_items_text($cart_count);
    
    			$options = get_option('sf_neighborhood_options');
    			$show_cart_count = false;
    			if (isset($options['show_cart_count'])) {
    				$show_cart_count = $options['show_cart_count'];
    			}
    			?>
    
    			<li class="parent shopping-bag-item">
    				<?php if ($show_cart_count) { ?>
    				<a class="cart-contents" href="<?php echo $woocommerce->cart->get_cart_url(); ?>" title="<?php _e('View your shopping bag', 'swiftframework'); ?>"><i class="sf-cart"></i><?php echo $cart_total; ?> (<?php echo $cart_count; ?>)</a>
    				<?php } else { ?>
    				<a class="cart-contents" href="<?php echo $woocommerce->cart->get_cart_url(); ?>" title="<?php _e('View your shopping bag', 'swiftframework'); ?>"><i class="sf-cart"></i><?php echo $cart_total; ?></a>
    				<?php }  ?>
    
    				<ul class="sub-menu">
    					<li>
    						<div class="shopping-bag">
    
    							<?php if ( sizeof($woocommerce->cart->cart_contents)>0 ) { ?>
    
    								<div class="bag-header"><?php echo $cart_count_text; ?> <?php _e('in the shopping bag', 'swiftframework'); ?></div>
    
    								<div class="bag-contents">
    
    									<?php foreach ($woocommerce->cart->cart_contents as $cart_item_key => $cart_item) { ?>
    
    								    	<?php
    									        $_product     		 = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
    									        $price 				 = apply_filters( 'woocommerce_cart_item_price', $woocommerce->cart->get_product_price( $_product ), $cart_item, $cart_item_key );
    
    									        $product_title       = $_product->get_title();
    									        $product_short_title = ( strlen( $product_title ) > 25 ) ? substr( $product_title, 0, 22 ) . '...' : $product_title;
    								        ?>
    
    								        <?php if ($_product->exists() && $cart_item['quantity']>0) { ?>
    
    								        	<div class="bag-product clearfix">
    
    								            	<figure><a class="bag-product-img" href="<?php echo get_permalink($cart_item['product_id']); ?>"><?php echo $_product->get_image(); ?></a></figure>
    
    									            <div class="bag-product-details">
    									           		<div class="bag-product-title">
    									           			<a href="<?php echo get_permalink($cart_item['product_id']); ?>">
    									           				<?php echo apply_filters( 'woocommerce_cart_widget_product_title', $product_short_title, $_product ); ?></a>
    									           		</div>
    									            	<div class="bag-product-price"><?php _e("Unit Price:", "swiftframework"); ?> <?php echo $price; ?></div>
    									            	<div class="bag-product-quantity"><?php _e('Quantity:', 'swiftframework'); ?> <?php echo $cart_item['quantity']; ?></div>
    									            </div>
    
    									            <?php echo apply_filters( 'woocommerce_cart_item_remove_link', sprintf('<a href="%s" class="remove" title="%s">&times;</a>', esc_url( $woocommerce->cart->get_remove_url( $cart_item_key ) ), __('Remove this item', 'swiftframework') ), $cart_item_key ); ?>
    
    									    	</div>
    
    								    	<?php } ?>
    
    								    <?php } ?>
    
    							    </div>
    
    							    <div class="bag-buttons">
    
    							    	<a class="sf-roll-button bag-button" href="<?php echo esc_url( $woocommerce->cart->get_cart_url() ); ?>"><span><?php _e('View shopping bag', 'swiftframework'); ?></span><span><?php _e('View shopping bag', 'swiftframework'); ?></span></a>
    
    							    	<a class="sf-roll-button checkout-button" href="<?php echo esc_url( $woocommerce->cart->get_checkout_url() ); ?>"><span><?php _e('Proceed to checkout', 'swiftframework'); ?></span><span><?php _e('Proceed to checkout', 'swiftframework'); ?></span></a>
    
    								</div>
    
    							<?php } else { ?>
    
    								<div class="bag-header"><?php _e("0 items in the shopping bag", "swiftframework"); ?></div>
    
    								<div class="bag-empty"><?php _e('Unfortunately, your shopping bag is empty.','swiftframework'); ?></div>
    
    								<div class="bag-buttons">
    
    									<?php $shop_page_url = get_permalink( woocommerce_get_page_id( 'shop' ) ); ?>
    
    									<a class="sf-roll-button shop-button" href="<?php echo esc_url( $shop_page_url ); ?>"><span><?php _e('Go to the shop', 'swiftframework'); ?></span><span><?php _e('Go to the shop', 'swiftframework'); ?></span></a>
    
    								</div>
    
    							<?php } ?>
    
    							</div>
    						</li>
    					</ul>
    				</li>
    
    			<?php
    
    			$fragments['.shopping-bag-item'] = ob_get_clean();
    
    			return $fragments;
    
    		}

    Thanks
    Mohammad

    #265895
    webmgr
    Member
    Post count: 80

    I placed the code in the functions.php file in my neighborhood-child theme. I replaced all the copy however nothing changed. The site works fine but the text did not change.

    Thanks Mohammad.
    webmgr

    #265901
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please provide me login detail to check and resolve the issue.
    Thanks
    Mohammad

    #265907
    webmgr
    Member
    Post count: 80
    This reply has been marked as private.
    #266057
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please try to use this plugin https://wordpress.org/plugins/real-time-find-and-replace/. It will change the text definitely.
    Thanks
    Mohammad

    #266270
    webmgr
    Member
    Post count: 80

    Thanks Mohammad.

    #266283
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    No problem. Thanks Mohammad.

    -Rui

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

You must be logged in and have valid license to reply to this topic.

License required for the following item
Login and Registration Log in · Register