Redirect to cart after adding to cart - Modular Theme

Solved
kevinmoyer
Tourist
10 0 0

Hey there,

We run a one-product store and would like to automatically redirect to the cart once someone clicks "Add to Cart" (right now, a cart popup appears in the top right).

I've scoured the community and can't find a solution to this common question for the Modular theme.

Does anyone have a good solution for this?

Thanks!

0 Likes
Prabhat
Shopify Expert
74 5 14

Well it seems like your theme have Ajax cart.
Can you provide link to your store ?

Solution Expert
- Did I solved your issue? Like & Mark As Solution to help the community
kevinmoyer
Tourist
10 0 0

Thanks - here is the URL: www.takewithcoffee.com

0 Likes
Prabhat
Shopify Expert
74 5 14

This is an accepted solution.

On Product.liquid 
Find something like this 

<div class="productForm-buttons">
<button class="productForm-submit js-productForm-submit " data-ajax="true" type="submit" data-handle="monthly-supply-1-day" style="visibility: visible;">Add to Cart</button>
</div>

and change it to  

<div class="productForm-buttons">
<button class="productForm-submit" type="submit" data-handle="monthly-supply-1-day" style="visibility: visible;">Add to Cart</button>
</div>


Hopes that solves the issue 

Solution Expert
- Did I solved your issue? Like & Mark As Solution to help the community
kevinmoyer
Tourist
10 0 0

Thanks, Prabhat.

I'm only seeing the following in my product.liquid file. Am I looking in the wrong place?

{%- assign on_sale = false -%}
{%- if product.compare_at_price > product.price -%}
{%- assign on_sale = true -%}
{%- assign on_sale_class = ' is-sale' -%}
{%- endif -%}

{%- assign sold_out = true -%}
{%- if product.available -%}
{%- assign sold_out = false -%}
{%- endif -%}

<div itemscope itemtype="http://schema.org/Product">
<meta itemprop="url" content="{{ shop.url }}{{ product.url }}">
<meta itemprop="description" content="{{ product.description | strip_html | escape | strip_newlines }}">
<meta itemprop="image" content="{{ product.featured_media.preview_image.src | img_url: 'grande' }}">
{%- if product.variants.first.barcode -%}
<meta itemprop="gtin8" content="{{ product.variants.first.barcode }}">
{%- endif -%}
{%- if product.vendor -%}
<meta itemprop="brand" content="{{ product.vendor | escape }}">
{%- endif -%}
{%- if product.first_available_variant.sku != blank -%}
<meta itemprop="sku" content="{{ product.first_available_variant.sku }}">
{%- else -%}
<meta itemprop="sku" content="{{ product.first_available_variant.id }}">
{%- endif -%}

{%- if product.first_available_variant.barcode.size == 12 -%}
<meta itemprop="gtin12" content="{{ product.first_available_variant.barcode }}">
{%- endif -%}
{%- if product.first_available_variant.barcode.size == 13 -%}
<meta itemprop="gtin13" content="{{ product.first_available_variant.barcode }}">
{%- endif -%}
{%- if product.first_available_variant.barcode.size == 14 -%}
<meta itemprop="gtin14" content="{{ product.first_available_variant.barcode }}">
{%- endif -%}

{%- section 'product-template' -%}
{%- section 'faq-section__product' -%}
{%- section 'related-products' -%}
</div>
0 Likes
Prabhat
Shopify Expert
74 5 14

Look into 

Section > product-template

As each theme is built differently. So you might find it there.

Solution Expert
- Did I solved your issue? Like & Mark As Solution to help the community
kevinmoyer
Tourist
10 0 0

Apologies, I'm new to Shopify, but I can't find that code anywhere, even when I search for some of the classes and data attributes from the snippet you shared.

What could I be missing? Appreciate your help Prabhat!

0 Likes
Prabhat
Shopify Expert
74 5 14

Well as I dont have access to the code I might not be able to figure out.
Do you mind sharing your screen over google meet ?

Solution Expert
- Did I solved your issue? Like & Mark As Solution to help the community
kevinmoyer
Tourist
10 0 0

Thanks, just sent you a DM.

0 Likes
jdclark
New Member
1 0 0

Hello!

I'm trying to do the same thing as Kevin -- change where the Add to Cart button points to within the Modular theme. I found the code in product-form.liquid, but am wondering how I point the button directly to checkout instead of the cart page. 

Thanks!

0 Likes