In this tutorial we learn how to redirect shop page to specific page
// Redirect WooCommerce Shop URL
function wc_shop_url_redirect() {
if( is_shop() ){
wp_redirect( home_url( '/tutorials/' ) ); // Assign custom internal page here
exit();
}
}
add_action( 'template_redirect', 'wc_shop_url_redirect' )
Woocommerce is best plugin in current market after it's sucess lots of demand
we cover in this articale how to add/remove fuctionality in woocommerce theme, these code snippets help you building your dynamic site
code is used for declaring WooCommerce support in your theme
function woocommerce_support() {
add_theme_support( 'woocommerce' );
}
add_action( 'after_setup_theme', 'woocommerce_support' );
you can replace woocommerce default shop page via WC snippet
function wc_shop_page_title( $page_title ) {
if( 'Shop' == $page_title) {
return "Usercode shop";
}
}
add_filter( 'woocommerce_page_title', 'wc_shop_page_title');
Single page cart button text change code
/ To change add to cart text on single product page
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woocommerce_custom_single_add_to_cart_text' );
function woocommerce_custom_single_add_to_cart_text() { return __( 'Buy Now', 'woocommerce' ); }
WC Archive page button text change
// To change add to cart text on product archives page
add_filter( 'woocommerce_product_add_to_cart_text', 'woocommerce_custom_product_add_to_cart_text' );
function woocommerce_custom_product_add_to_cart_text() { return __( 'Buy Now', 'woocommerce' );}
function add_to_cart_checkout_redirect() {
wp_safe_redirect( get_permalink( get_option( 'woocommerce_checkout_page_id' ) ) );
die();
}
add_action( 'woocommerce_add_to_cart', 'add_to_cart_checkout_redirect', 16 );
We discus in this artical how remove woccommerce add-to-cart button in good way, you can find lots of tutorial in this topic but we cover simple ans secure way to the complete this task.
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
Are you wondering how to completely or partially turn off WordPress comments?
While comments are a great way to engage your site visitors, you might not want to allow comments on your site for a number of reasons. There are a lot of ways you can disable comments, from only on specific posts, pages, or custom post types, to even completely removing comments from your entire website.
In this article, we’ll show you the step-by-step process of how to disable comments in WordPress.
There are many reasons why you might want to turn off comments on specific posts or pages, or disable comments on your whole website.
For example, bloggers may publish certain posts like announcements that they don’t want to allow comments on. In these cases, you can easily disable comments on those specific posts or pages.