Add to cart buttons on frontpage / homepage - Shoptimized theme

Hi

I have been in contact with the author of the theme, Add to cart buttons cannot be added to the home page/front page of the shop. This is hard for me to believe.

I was able to post a string of code to give me a add to cart button, but this also gave the collections pages add to cart button. Collections pages then had 2 add to cart buttons.

I hope someone can help me to add to cart button only to the front page / home page.

Preview link; https://norwegianfoodstore.com/?_ab=0&_fd=0&_sc=1&preview_theme_id=135292616937

Thanks

Hi @maxlime

I have been in contact with the author of the theme, Add to cart buttons cannot be added to the home page/front page of the shop. This is hard for me to believe.

More likely they mean they cannot customize the theme for you, or that the theme does not have a section exclusively for an add to cart button or that fits the use case.

If the theme has a custom-html section either just try adding a buy button.

https://help.shopify.com/en/manual/online-sales-channels/buy-button

Or all an add-to-cart(ATC) button is really is a url query to the /cart endpoint.

So if not using locales simply make a link setup to add a product using the info in the ajax api docs.

https://shopify.dev/api/ajax/reference/cart#post-locale-cart-add-js

If the theme is OS2.0 compatable see if it has a custom-liquid section, or if so check resources like the parters code examples for snippets that may guide you to a customization.

https://shopify.github.io/liquid-code-examples/

Beyond that, that theme is not available in the shopify theme store so expect limited support or contributions.

If such a theme has it’s own forums it can be best to pursue answers there.

Hi @maxlime

We can add the add to cart button on the home page by customizing the featured product liquid file.

@SmallTask I send you an email