如何移动“返回商店"在购物车页面上的购物车总计之后 [英] How to move the "Return to shop" after the cart-totals on cart page
问题描述
我想移动返回商店"在购物车总计之后,在移动购物车页面上,但在结帐"之前按钮.
这可能吗?也许把它挂到 ̀<?php do_action( 'woocommerce_after_cart_totals' );?>
在 cart-totals.php
中(如果可能),但如何解开它,因为它是硬编码在文件 cart.php 中的:
<a class="button wc-backward return-to-shop-cart-wholesale";href="/wholesale-ordering/"><?php esc_html_e('返回专卖店', 'woocommerce');?></a><a class="button wc-backward return-to-shop-cart-retail";href="<?php echo esc_url( apply_filters( 'woocommerce_return_to_shop_redirect', wc_get_page_permalink( 'shop' ) );?>>><?php esc_html_e('返回商店', 'woocommerce');?></a><?php/*** 购物车抵押品挂钩.** @hooked woocommerce_cross_sell_display* @hooked woocommerce_cart_totals - 10*/do_action('woocommerce_cart_collaterals');?>
另外,我可以只为移动布局做吗?
您可以通过以下方式执行此操作:首先用这个css隐藏'Return to Shope',
@media screen and (max-width: 600px) {.woocommerce-cart .return-to-shop { display: none !important;}}
我们使用 @media 和600px"来仅定位移动设备.
然后在结帐"之前添加该按钮,
do_action('woocommerce_after_cart_totals', 'isnert_shop_back_button');函数 isert_shop_back_button(){<div class="cart-collaterals"><a class="button wc-backward return-to-shop-cart-wholesale";href="/wholesale-ordering/"><?php esc_html_e('返回专卖店', 'woocommerce');?></a><a class="button wc-backward return-to-shop-cart-retail";href="<?php echo esc_url( apply_filters( 'woocommerce_return_to_shop_redirect', wc_get_page_permalink( 'shop' ) );?>>><?php esc_html_e('返回商店', 'woocommerce');?></a><?php/*** 购物车抵押品挂钩.** @hooked woocommerce_cross_sell_display* @hooked woocommerce_cart_totals - 10*/do_action('woocommerce_cart_collaterals');?>
}
我刚刚使用了您必须显示返回商店"按钮的代码,但在函数 isert_shop_back_button() 中,您可以放置任何您想要的东西.
尝试一下,让我知道会发生什么.
I'd like to move the "Return to shop" after the cart-totals, on the mobile cart page, but before the "checkout" button.
Is that possible? Maybe hook it to ̀<?php do_action( 'woocommerce_after_cart_totals' ); ?>
in cart-totals.php
if possible, but how to unhook it because it is hardcoded in the file cart.php:
<div class="cart-collaterals">
<a class="button wc-backward return-to-shop-cart-wholesale" href="/wholesale-ordering/">
<?php esc_html_e( 'Return to pro shop', 'woocommerce' ); ?>
</a>
<a class="button wc-backward return-to-shop-cart-retail" href="<?php echo esc_url( apply_filters( 'woocommerce_return_to_shop_redirect', wc_get_page_permalink( 'shop' ) ) ); ?>">
<?php esc_html_e( 'Return to shop', 'woocommerce' ); ?>
</a>
<?php
/**
* Cart collaterals hook.
*
* @hooked woocommerce_cross_sell_display
* @hooked woocommerce_cart_totals - 10
*/
do_action( 'woocommerce_cart_collaterals' );
?>
</div>
Also, can I do it only for mobile layout?
You can do this by the follwoing: first hide the 'Return to Shope' with this css,
@media screen and (max-width: 600px) {
.woocommerce-cart .return-to-shop { display: none !important; }
}
We use @media and '600px' to target only mobile devices.
Then add that button before the 'checkout',
do_action( 'woocommerce_after_cart_totals', 'isnert_shop_back_button' );
function isnert_shop_back_button(){
<div class="cart-collaterals">
<a class="button wc-backward return-to-shop-cart-wholesale" href="/wholesale-ordering/">
<?php esc_html_e( 'Return to pro shop', 'woocommerce' ); ?>
</a>
<a class="button wc-backward return-to-shop-cart-retail" href="<?php echo esc_url( apply_filters( 'woocommerce_return_to_shop_redirect', wc_get_page_permalink( 'shop' ) ) ); ?>">
<?php esc_html_e( 'Return to shop', 'woocommerce' ); ?>
</a>
<?php
/**
* Cart collaterals hook.
*
* @hooked woocommerce_cross_sell_display
* @hooked woocommerce_cart_totals - 10
*/
do_action( 'woocommerce_cart_collaterals' );
?>
</div>
}
I just used the code you have to display the button 'Return TO SHope' but inside the function isnert_shop_back_button() you can place anything you want.
Try it and let me know what happen.
这篇关于如何移动“返回商店"在购物车页面上的购物车总计之后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!