Jump to content

Redirect from "/cart"

Go to solution Solved by paul2009,

Recommended Posts

Hello.

Client is not using this function so would like this url to redirect to home, however it's not working.

I have this in URL mappings:

https://www.opsishealth.com/cart -> https://www.opsishealth.com/ 301

 

Also have tried relative urls, but they aren't doing anything either.

Maybe this page can't be redirected? I don't see it listed within my list of pages.

I think I am missing something simple.

Thanks for any advice.

Link to comment
  • Replies 14
  • Views 2k
  • Created
  • Last Reply

Top Posters In This Topic

  • Solution
1 hour ago, Upperhouse said:

Client is not using [the cart] function so would like this url to redirect to home

Redirections will not work for the cart page because they only work when the redirected URL does not exist. The /cart page will always exist because it cannot be removed. The same is true for all reserved url slugs

About me: I've been a SQSP User for 18 yrs. I was invited to join the Circle when it launched in 2016. I have been a Circle Leader since 2017. I don't work for Squarespace. I value honesty, transparency, diversity and good design ♥.
Work: I founded and run SF.DIGITAL, building Squarespace Extensions to supercharge your commerce website. 
Content: Views and opinions are my own. Links in my posts may refer to SF.DIGITAL products or may be affiliate links.
Forum advice is free. You can thank me by clicking one of the feedback emojis below. Coffee is optional.

Link to comment

As @paul2009 mentions the cart page can't be removed. However with JavaScript it is possible to redirect the cart to another URL. You have to be on a plan that allows JavaScript to run on your site.

Add the following to Settings > Advanced > Code Injection > HEADER.

<script>

  ( ( ) => {
  
    /*
    
      cart page redirect to url
      
      Version     : 0.1.0
      
      SS Versions : 7.1, 7.0
      
      By          : Thomas Creedon < http://www.tomsWeb.consulting/ >
      
      */
      
    const url = '[enter url here between single quotes replacing square brackets]';
    
    // do not change anything below, there be the borg here
    
    if ( location.pathname != '/cart' ) return; // bail if not cart page
    
    location.href = url;
    
    } ) ( );
    
  </script>

Let us know how it goes.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
  • 5 months later...

Hi guys.. I have a Commerce site for my artwork, but I do not want the shopping bag icon or checkout page AT ALL. I would prefer for customers to send me a form inquiring about artwork purchases instead of checking out via my page. How do I redirect my Shopping Bag icon (that I can't seem to fully remove no matter what code I use) to redirect to a contact/form page on Squarespace?

Edited by cabarnett13
Link to comment
6 minutes ago, cabarnett13 said:

I have a Commerce site for my artwork, but I do not want the shopping bag icon or checkout page AT ALL.

Please post the URL for a page on your site where we can see your issue.

A link to the backend of the your site won’t work for us, i.e. a url that contains /config/.

Please set up a site-wide password, if your site is not public and you've not already done so.

Post the password here.

Adding a site-wide password does not allow anyone to alter your site. It only allows those with the password to see your site.

Please read the site-wide password and how to share a link documentation to understand how they work.

We can then take a look at your issue.

You may find How to post a forum question post useful.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
12 minutes ago, cabarnett13 said:

I have a Commerce site for my artwork, but I do not want the shopping bag icon or checkout page AT ALL. I would prefer for customers to send me a form inquiring about artwork purchases

Please see my post here:

Did this help? Please give feedback by clicking an icon below  ⬇️

About me: I've been a SQSP User for 18 yrs. I was invited to join the Circle when it launched in 2016. I have been a Circle Leader since 2017. I don't work for Squarespace. I value honesty, transparency, diversity and good design ♥.
Work: I founded and run SF.DIGITAL, building Squarespace Extensions to supercharge your commerce website. 
Content: Views and opinions are my own. Links in my posts may refer to SF.DIGITAL products or may be affiliate links.
Forum advice is free. You can thank me by clicking one of the feedback emojis below. Coffee is optional.

Link to comment

As much as the extension would be helpful.. I am broke. I need to sell some artwork before purchasing more from Squarespace... thanks. A code would be more helpful. I really need a code to redirect my 'add to cart' button to my contact page. I really need my 'add to cart' button' to go elsewhere but the checkout page 

 

Edited by cabarnett13
Link to comment

Please, if anyone can you help me... this is my business to help me with a financial crisis from the pandemic. Squarespace agents will not help me. This one redirect is preventing my website from being functional. please help me. I am frustrated and overwhelmed... all i want is a redirect code. please 

Link to comment
16 hours ago, cabarnett13 said:

As much as the extension would be helpful.. I am broke. A code would be more helpful.

Just as you charge for your paintings, I think it is fair to expect the developers to charge for the complicated code they write.  They need to earn a living from their work too, right?

If you need a free suggestion....why not create a contact form on a new page and then link to it from each product description? People can then contact you with ease.

 

 

Link to comment
  • 9 months later...
On 7/26/2022 at 8:05 PM, creedon said:

As @paul2009 mentions the cart page can't be removed. However with JavaScript it is possible to redirect the cart to another URL. You have to be on a plan that allows JavaScript to run on your site.

Add the following to Settings > Advanced > Code Injection > HEADER.

<script>

  ( ( ) => {
  
    /*
    
      cart page redirect to url
      
      Version     : 0.1.0
      
      SS Versions : 7.1, 7.0
      
      By          : Thomas Creedon < http://www.tomsWeb.consulting/ >
      
      */
      
    const url = '[enter url here between single quotes replacing square brackets]';
    
    // do not change anything below, there be the borg here
    
    if ( location.pathname != '/cart' ) return; // bail if not cart page
    
    location.href = url;
    
    } ) ( );
    
  </script>

Let us know how it goes.

HI @creedon Thank you so much for posting this javascript code injection solution. I was able to use this to redirect from the 'cart' page/button, but i can't get this approach to work to redirect from the 'checkout'/purchase button on the product page . This is more important as for me, when you are on the product/service page and you click the button to purchase (which ordinarily takes you to the SSL checkout), because this is the main call to action on the page and most people wont actually be using the cart button.

i did actually modify the code below where you had your if statement because i noticed that the url on the checkout pages always create a unique URL that always begins with 'checkout' but then allows for a specific instance of purchasing the product, so i figured the include() function would help here.  i know that the syntax works because i tested this format with with '/cart' instead of '/checkout' and it was functional, but for some reason this doesnt actually work when it comes to redirecting the checkout pages.

 

any ideas here why this code works with the cart page but not the checkout pages?

 

snippet:

    if ( location.pathname.includes('/checkout') ) location.href = url; // bail if not cart page
    return;

Link to comment
17 minutes ago, jf-dp said:

any ideas here why this code works with the cart page but not the checkout pages?

Custom code is not loaded for the /checkout page. It is a SS security feature.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.