Redirect to a survey after adding to cart

Solved
Highlighted
New Member
5 0 0

I'm needing to redirect people to a page after they add something to their cart to complete a survey before proceeding to their cart. I have the survey page completed. I found a resource on how change the add to cart button so it redirects to a different page but that made it so the item didn't actually get added to the cart. I need it to add to the cart > go to survey page > go to cart.

I was thinking the functionality would be similar to an upsell landing page in that it adds to cart + redirects. I just want to redirect to a specific page with a form on it instead of a product page.

Anyone know if this is possible and how to get it done? 

Thanks!

0 Likes
Highlighted
Shopify Partner
280 29 55

This is an accepted solution.

Hi,
Inside products add to cart form, add this input
<input type="hidden" name="return_to" value="/path/to-your-page" />

If helpful then please Like and Accept Solution.
Email: suhagiyajivan1992@gmail.com
Skype: jivan.suhagiya
Give a try to Shopify APP: https://apps.shopify.com/short-track
1 Like
Highlighted
New Member
5 0 0

@Jivan_Suhagiya thanks for the snippet. Can you help me a bit more with exactly where to put this? I am in the product-form.liquid and just not exactly sure what to place it between. Thank you for any advice on this!

0 Likes
Highlighted
New Member
5 0 0

Actually it's working now and works great! Here is where I put the code: 

<div class="product__submit__buttons">
          <input type="hidden" name="return_to" value="/pages/survey" />
          <button
                  type="submit"
                  name="add"
                  class="btn product__submit__add"
                  data-add-to-cart
                  {% unless current_variant.available %}disabled="disabled"{% endunless %}>
            <span data-add-to-cart-text>
              {% if current_variant.available %}
              {{ 'products.product.add_to_cart' | t }}
              {% else %}
              {{ 'products.product.sold_out' | t }}
              {% endif %}
            </span>
          </button>
0 Likes
Highlighted
Tourist
4 0 1

Hi Kristineneil, 

I have been looking for a while for the same thing you mentioned.

I'm looking to do Diet packages and after the customer add a package to cart should be redirected to Survey or a questionnaire page to answer more information.

Could you please explain how you did the questionnaire page and also the coding for redirecting and in what file to put it. 

Thanks in advance 

 

0 Likes
Highlighted
New Member
5 0 0

Hi @RaadOmer - I placed the snippet in the liquid code for the product page. The name of this file will depend on your theme/template. Just find where the <button> code is and insert the snippet like I showed in my example. 

0 Likes
Highlighted
Tourist
4 0 1

Dear Kristineneil, 

Thank you for your prompt response, I do appreciate your support regarding this matter. I had followed your instructions but I'm not sure where is the <button> code to insert the snippet you mentioned in your previous message. The below picture is product.liquid page can you let me know where to paste the snippet in it. Thanks in advance

Product.liq.JPG

0 Likes
Highlighted
New Member
5 0 0

It's hard to say without seeing the full code. I would recommend doing a ctl/cmd + F to search for "Button" to jump you to the right place in the code. 

0 Likes