Reputation: 2608
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?
Upvotes: 1
Views: 356
Reputation: 733
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.
Upvotes: 1