Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Neighborhood › Modify Text in Cart Summary
New Landing › How can we help? › Themeforest Theme Support › Neighborhood › Modify Text in Cart Summary
- This topic has 7 replies, 3 voices, and was last updated 7 years by Rui Guerreiro – SUPPORT.
-
Posted in: Neighborhood
-
May 5, 2016 at 10:09 pm #265709
Following your response to a post by LouisaMel at
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.phpI 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.
webmgrAttachments:
You must be logged in to view attached files.May 6, 2016 at 8:39 am #265756Hi,
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">×</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
MohammadMay 6, 2016 at 6:02 pm #265895I 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.
webmgrMay 6, 2016 at 6:06 pm #265901Hi,
Please provide me login detail to check and resolve the issue.
Thanks
MohammadMay 6, 2016 at 6:39 pm #265907This reply has been marked as private.May 9, 2016 at 8:07 am #266057Hi,
Please try to use this plugin https://wordpress.org/plugins/real-time-find-and-replace/. It will change the text definitely.
Thanks
MohammadMay 9, 2016 at 6:05 pm #266270Thanks Mohammad.
May 9, 2016 at 7:03 pm #266283No problem. Thanks Mohammad.
-Rui
-
Posted in: Neighborhood
You must be logged in and have valid license to reply to this topic.