How to give dropdown option to change size variant in cart page (Dawn Theme)

Hello

I want to give dropdown option to change size variant in cart page.

My website url : www.jagstore.in

@Jayesh-Agarwal ,

Step-by-Step Guide to Adding a Size Variant Dropdown in Shopify Cart:

1. Access Your Shopify Theme Code:- Login to Shopify Admin:

Navigate to your Shopify admin panel.

  • Go to Themes:
    In the Shopify admin, click on Online Store and then Themes.
  • Edit Theme Code:
    Under your current theme, click Actions > Edit Code.

  1. Locate and Edit the Cart Section:- Find the Cart Template:
    In the Sections folder, locate the main-cart-items.liquid file. This file typically handles the items displayed in the cart.
  • Add the Size Variant Form:
    Scroll to the bottom of the file and paste the following code just before the closing {% endfor %} or where appropriate based on your theme structure:

      {% assign has_size_option = false %}
      {% for option in item.product.options_with_values %}
        {% if option.name == 'Size' %}
          {% assign has_size_option = true %}
        {% endif %}
      {% endfor %}

      
      {% if has_size_option %}
        
      {% endif %}

Add this code to the same file before starting the schema.


Hi @Jayesh-Agarwal

You can do that, but instead change variant you need remove the item need change and add new item into cart.

To achieve your expected you need customize so much code logic on cart page also user experience.

Hello

I did as per your instructions. Size is not updated. Kindly check below screenshot


for reference

Hello,

Can you provide me with store access so I can check and provide the exact solution?

Email id : rajesh.zestard@gmail.com