Digital experiences for all disciplines
New Landing › How can we help? › Atelier › Add text to dropdown cart?
New Landing › How can we help? › Atelier › Add text to dropdown cart?
- This topic has 15 replies, 2 voices, and was last updated 8 years by Mohammad – SUPPORT.
-
Posted in: Atelier
-
February 25, 2016 at 4:32 pm #252056
Amazing theme!
Is it possible to add some text below the “view checkout” in the dropdown add to cart? Like attached?Attachments:
You must be logged in to view attached files.February 26, 2016 at 9:57 am #252145Hi,
Please paste this code at functions.php of child theme.function sf_woo_header_add_to_cart_fragment( $fragments ) { global $woocommerce, $sf_options; ob_start(); $show_cart_count = false; if ( isset( $sf_options['show_cart_count'] ) ) { $show_cart_count = $sf_options['show_cart_count']; } if ( sf_theme_opts_name() == "sf_atelier_options" ) { $cart_total = '<span class="menu-item-title">' . __( "Cart" , "swiftframework" ) . '</span>'; } else { $cart_total = WC()->cart->get_cart_total(); } $cart_count = $woocommerce->cart->cart_contents_count; $cart_count_text = sf_product_items_text( $cart_count ); $cart_count_text_alt = sf_product_items_text( $cart_count, true ); $view_cart_icon = apply_filters( 'sf_view_cart_icon', '<i class="ss-view"></i>' ); $checkout_icon = apply_filters( 'sf_checkout_icon', '<i class="ss-creditcard"></i>' ); $go_to_shop_icon = apply_filters( 'sf_go_to_shop_icon', '<i class="ss-cart"></i>' ); $extra_class = ""; if ( $cart_count != "0" ) { $extra_class .= "cart-not-empty "; } ?> <li class="parent shopping-bag-item <?php echo $extra_class; ?>"> <?php if ( $show_cart_count ) { ?> <a class="cart-contents" href="<?php echo esc_url($woocommerce->cart->get_cart_url()); ?>" title="<?php _e( 'View your shopping cart', 'swiftframework' ); ?>"> <?php echo apply_filters( 'sf_header_cart_icon', '<i class="ss-cart"></i>' ); ?><?php echo $cart_total; ?><span class="num-items cart-count-enabled"><?php echo $cart_count_text_alt; ?></span></a> <?php } else { ?> <a class="cart-contents" href="<?php echo esc_url($woocommerce->cart->get_cart_url()); ?>" title="<?php _e( 'View your shopping cart', 'swiftframework' ); ?>"><?php echo apply_filters( 'sf_header_cart_icon', '<i class="ss-cart"></i>' ); ?><?php echo $cart_total; ?><span class="num-items"><?php echo $cart_count_text_alt; ?></span></a> <?php } ?> <ul class="sub-menu"> <li> <div class="shopping-bag" data-empty-bag-txt="<?php _e( 'Your cart is empty.', 'swiftframework' ); ?>" data-singular-item-txt="<?php _e( 'item in the cart', 'swiftframework' ); ?>" data-multiple-item-txt="<?php _e( 'items in the cart', 'swiftframework' ); ?>"> <div class="loading-overlay"><i class="sf-icon-loader"></i></div> <?php if ( $cart_count != "0" ) { ?> <div class="bag-header"><?php echo $cart_count_text; ?> <?php _e( 'in the cart', 'swiftframework' ); ?></div> <div class="bag-contents"> <?php foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) { ?> <?php $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key ); $product_title = $_product->get_title(); $price = apply_filters( 'woocommerce_cart_item_price', $woocommerce->cart->get_product_price( $_product ), $cart_item, $cart_item_key ); ?> <?php $variation_id_class = ''; if ( $cart_item['variation_id'] > 0 ) $variation_id_class = ' product-var-id-' . $cart_item['variation_id']; if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_cart_item_visible', true, $cart_item, $cart_item_key ) ) { ?> <div class="bag-product clearfix product-id-<?php echo $cart_item['product_id']; ?><?php echo $variation_id_class; ?>"> <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_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> <a href="#" class="remove-product remove" data-ajaxurl="<?php echo admin_url( 'admin-ajax.php' ); ?>" data-product-id="<?php echo $cart_item['product_id'];?>" data-variation-id="<?php echo $cart_item['variation_id'];?>" data-product-qty="<?php echo $cart_item['quantity'];?>" title="<?php echo __( 'Remove this item', 'swiftframework' ); ?>">×</a> </div> <?php } ?> <?php } ?> </div> <?php if ( sf_theme_opts_name() == "sf_atelier_options" ) { ?> <div class="bag-total"> <?php if ( class_exists( 'Woocommerce_German_Market' ) ) { ?> <span class="total-title"><?php _e( "Total incl. tax", "swiftframework" ); ?></span> <?php } else { ?> <span class="total-title"><?php _e( "Total", "swiftframework" ); ?></span> <?php } ?> <span class="total-amount"><?php echo WC()->cart->get_cart_total(); ?></span> </div> <?php } ?> <div class="bag-buttons"> <a class="sf-button standard sf-icon-reveal bag-button" href="<?php echo esc_url( $woocommerce->cart->get_cart_url() ); ?>"> <?php echo $view_cart_icon; ?> <span class="text"><?php _e( 'View cart', 'swiftframework' ); ?></span> </a> <a class="sf-button standard sf-icon-reveal checkout-button" href="<?php echo esc_url( $woocommerce->cart->get_checkout_url() ); ?>"> <?php echo $checkout_icon; ?> <span class="text"><?php _e( 'Proceed to checkout', 'swiftframework' ); ?></span> </a> <span> Add <?php $ship_cart = WC()->cart->get_cart_total(); $ship_cart = 50-$ship_cart; echo $ship_cart; ?> to your cart and get free shipping!</span> </div> <?php } else { ?> <div class="bag-empty"><?php _e( 'Your cart is empty.', 'swiftframework' ); ?></div> <?php } ?> </div> </li> </ul> </li> <?php $fragments['.shopping-bag-item'] = ob_get_clean(); return $fragments; }
Thanks
MohammadFebruary 27, 2016 at 8:38 pm #252428Thanks for your quick reply Mohammed.
Where will I have to incorporate my own text then? When I add this to child-theme (functions.php), nothing seems so change in my cart.February 29, 2016 at 6:37 am #252531Hi,
Please provide me login detail after installing WPIDE plugin.
Thanks
MohammadMarch 22, 2016 at 10:29 am #257010This reply has been marked as private.March 22, 2016 at 10:46 am #257015Hi,
Please provide me website url to check and resolve the issue.
Thanks
MohammadMarch 22, 2016 at 10:47 am #257017This reply has been marked as private.March 22, 2016 at 11:10 am #257031Hi,
I need also website url.
Thanks
MohammadMarch 22, 2016 at 11:11 am #257032This reply has been marked as private.March 22, 2016 at 2:07 pm #257119Let me know if you need anymore infomration 🙂
March 23, 2016 at 2:04 pm #257387This reply has been marked as private.March 23, 2016 at 3:00 pm #257421Hi,
Yes, of course. I support from india.
Thanks
MohammadMarch 23, 2016 at 3:02 pm #257422Amazing! Looking forward to hear how it goes 🙂
March 23, 2016 at 3:11 pm #257426Hi,
I see that you need to activate the child theme and check it. Let me know feedback.
Thanks
MohammadMarch 23, 2016 at 3:17 pm #257429Thanks Mohammad,
Are there any worries/issues I need to be aware of before activating? -
Posted in: Atelier
You must be logged in and have valid license to reply to this topic.