New Landing How can we help? Atelier How to change shop page?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Posted in: Atelier
  • #245704
    solidsn2004
    Member
    Post count: 208

    Hello,

    I am making this website that will only have one product with variations so I don’t really need the shop page but only a product page. Is there a way to skip the grid shop page and set the shop page to a product immediately?

    For now I have created a custom link in the menu and added the link of the product page but with this way I am having other issues. For example if I have an empty cart there is a button (“Return to Shop”) that takes you to the shop page which I don’t want people to see.

    Is there a way to change the shop in a different way? If not can you help me change the redirect button of shop to my product page?
    I have already installed a child theme and I found that the redirect button is located in plugins/woocommerce/templates/cart/empty.php
    I am guessing I need to add this to my child theme and change the part of the button redirection.

    if ( ! defined( 'ABSPATH' ) ) {
    	exit; // Exit if accessed directly
    }
    
    wc_print_notices();
    
    ?>
    
    <p class="cart-empty">
    	<?php _e( 'Your cart is currently empty.', 'woocommerce' ) ?>
    </p>
    
    <?php do_action( 'woocommerce_cart_is_empty' ); ?>
    
    <p class="return-to-shop">
    	<a class="button wc-backward" href="<?php echo esc_url( apply_filters( 'woocommerce_return_to_shop_redirect', wc_get_page_permalink( 'shop' ) ) ); ?>">
    		<?php _e( 'Return To Shop', 'woocommerce' ) ?>
    	</a>
    </p>

    I am guessing what I need to change is the ‘shop’ page in line 16 but I am not really sure how to achieve this. The link of my product page now is “http://www.elefante-boa.com/product/elefante-boa/&#8221;

    password to see page is the same as your login.

    Could you help me with this?
    Thanks in advance.

    #245709
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Hi

    You can use a redirect plugin to redirect the shop page to the product page, this is the simplest method. If you want to go with one of the more complicated methods, please search google as there are a few tutrials

    – Kyle

    #245723
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    1- Please paste this code at functions.php of child theme.

    function wc_empty_cart_redirect_url() {
    	return 'http://www.elefante-boa.com/product/elefante-boa/';
    }
    add_filter( 'woocommerce_return_to_shop_redirect', 'wc_empty_cart_redirect_url');

    2- Paste this code at .htaccess file.

    RewriteCond %{HTTP_HOST} ^www.elefante-boa.com/shop$ [NC]
    RewriteRule ^(.*)$ http://www.elefante-boa.com/product/elefante-boa/$1 [R=301,L]
    
    

    Thanks
    Mohammad

    #245726
    solidsn2004
    Member
    Post count: 208

    Ok thanks for the reply Kyle but I didn’t really want to add another plugin.
    I resolved this by going to functions.php file of the child theme and adding the following code:

    /**
     * Changes the redirect URL for the Return To Shop button in the cart.
     *
     * @return string
     */
    function wc_empty_cart_redirect_url() {
    	return 'http://yourdomain.com/your-page/';
    }
    add_filter( 'woocommerce_return_to_shop_redirect', 'wc_empty_cart_redirect_url' );
    #245728
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Ok great!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register