B-219 Sec-55 Noida, India
+918010221733

Add a view cart button to woocommerce product pages

Do you want to add a “view cart” button to woocommerce product pages? Use the below code for it

add_action( 'wp_head', 'add_cart_btn_on_product_page' );

function add_cart_btn_on_product_page() {

?>
<script>
jQuery(function($){
var html = '<div class="cart_btn"><a href="<?php echo get_site_url(); ?>/cart/" class="button wc-forward">View Your Cart</a></div><br/>';
$('.single-product form.cart').after(html);
});
</script>
<?php

}
(Visited 20 times, 1 visits today)