Code so drop down is abover add to cart

I have the code for all my drop down menus. I had them installed before and then chose to go to an app because custom code drop downs won’t track sales. Apps don’t do that either so I just want to put the code back in. Now when I add the code, it’s popping up below the “Add TO Cart” button and I want it above. Anyone know what code to us and where to put it? I have this info below but I can’t find the add to cart form anywhere. I’m using the Refresh Theme.

The only thing I can find is:

To place text or a menu above the Add to Cart button, you need to edit the product template file in your Shopify theme code. The specific file is typically named main-product.liquid, product-template.liquid, or product-card.liquid (or product-grid-item.liquid for collection pages).

  1. Navigate to Code Editor: Go to Online Store > Themes > Actions > Edit Code.

  2. Locate the File: Find the file mentioned above in the Sections or Snippets directory.

  3. Insert Code: Locate the existing Add to Cart form code. Insert your menu or text code before the <form> tag that contains the Add to Cart button.

If using metafields for dynamic text, you can add a metafield in Settings > Custom Data, then insert the following code above the button in your theme file:

{% if product.metafields.custom.custom_text %}
  <div class="custom-menu">
    {{ product.metafields.custom.custom_text }}
  </div>
{% endif %}

Ensure you duplicate your theme before making changes to avoid losing live site functionality.

Thanks!

First, what is the “dropdown menus” you are trying to add to the product page? Maybe you’re using the wrong words to describe what it is. Sounds like a Line Item Property.

Second, where exactly are you putting this code? You don’t just put code somewhere and hope for the best.

Third, really think about what you’re doing. Your advice says put it before the <form. Is this going with the product to the cart?

So go to your product template, click on the Product Information section, go to the three dots in the Settings and click “edit code”.

Look at this file. See where it is rendering the variant picker and the buy buttons? Render means it is calling a snippet to be shown. So you just go to the buy buttons snippet:

Now check this out. Enjoy :grinning_face:

Now I’m just playing around, and probably not going to make whatever it is your trying to do work, but at least you can see how to put something somewhere and check out where it shows up.

I have done this before but have forgotten where I put it. Then I figured it out but never needed to tell the code to put it above the cart button. I had the code in there today and it was in the right spot but it wasn’t up above the “add to cart” button when I checked the website. It might be because the app I have doing my drop downs is holding that spot.

You can see the dropdown here: Natural Deodorant 6-Pack | Aluminum & Baking Soda Free | Buy 5 Get 1 FREE – Gentle Moose

Add just so you know, I sort of know what I’m doing. Good info though, I see what you’re doing there. I have never put anything in the buy-buttons.liquid before. I put this in main-product.liquid before at about line 650 and it worked perfect. Now it shows up UNDER the add to cart. Shopify has made changes to the theme though so things are different every time I go in to do an edit.