Last active
October 13, 2024 06:54
-
-
Save emre-edu-tech/d6b932cf6155a0d0a8dd15bc0283d46a to your computer and use it in GitHub Desktop.
Code snippet that adds Back to Products/Shop button on Single Product Template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add "Back to Shop" button on Single Product Template | |
// Sometimes it is useful a button to get back to Shop page | |
add_action('woocommerce_before_single_product', 'print_back_to_products_btn'); | |
function print_back_to_products_btn() { | |
$shop_page_url = get_permalink(woocommerce_get_page_id( 'shop' )); | |
echo '<a style="margin-bottom: 10px" class="button" href="' . $shop_page_url . '"><i class="fas fa-arrow-left"></i> All Products</a>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment