How to update total Pirce on shopify cart page
19:18 21 Aug 2025

I am trying to update total price on shopify cart page. cart section on shopify

total price don't update like this. this is response after page load response data from cart.js

{
"token": "hWN203uf9SnlUssKBp2VwOxu?key=41602ca60e595fdd84383ed9f7f267e7",
"note": "",
"attributes": {},
"original_total_price": 11899,
"total_price": 11899,
"total_discount": 0,
"total_weight": 0,
"item_count": 1,
"items": [
    {
        "id": 45221821251734,
        "properties": {
            "totalPrice": "13325",
            "Tex-Mex Beef Bowl": "6",
            "Honey Chipotle Shrimp + $1.99": "4"
        },
        "quantity": 1,
        "variant_id": 45221821251734,
        "key": "45221821251734:f3f0a68b1ef29c6715cc3f468849dfd2",
        "title": "10-pack Lean Meal",
        "price": 11899,
        "original_price": 11899,
        "presentment_price": 118.99,
        "discounted_price": 11899,
        "line_price": 11899,
        "original_line_price": 11899,
        "total_discount": 0,
        "discounts": [],
        "sku": null,
        "grams": 0,
        "vendor": "My Store",
        "taxable": false,
        "product_id": 8454308102294,
        "product_has_only_default_variant": true,
        "gift_card": false,
        "final_price": 11899,
        "final_line_price": 11899,
        "url": "/products/10-pack-4oz-lean-meal?variant=45221821251734",
        "featured_image": {
            "aspect_ratio": 1.115,
            "alt": "10-pack Lean Meal",
            "height": 408,
            "url": "https://cdn.shopify.com/s/files/1/0696/0408/1814/files/10pack.png?v=1755793206",
            "width": 455
        },
        "image": "https://cdn.shopify.com/s/files/1/0696/0408/1814/files/10pack.png?v=1755793206",
        "handle": "10-pack-4oz-lean-meal",
        "requires_shipping": true,
        "product_type": "4oz-10-pack",
        "product_title": "10-pack Lean Meal",
        "product_description": "This 10-pack of lean meals delivers 4 ounces of protein per serving, providing a balanced and efficient option for those focused on muscle maintenance and healthy nutrition. Each meal is carefully portioned to support your dietary goals with high-quality protein, making it ideal for fitness enthusiasts and busy professionals seeking convenient, nutritious meals.",
        "variant_title": null,
        "variant_options": [
            "Default Title"
        ],
        "options_with_values": [
            {
                "name": "Title",
                "value": "Default Title"
            }
        ],
        "line_level_discount_allocations": [],
        "line_level_total_discount": 0,
        "has_components": false
    }
],
"requires_shipping": true,
"currency": "USD",
"items_subtotal_price": 11899,
"cart_level_discount_applications": [],
"discount_codes": []

}

I added propertise{totalPrice], but can't update other(final_price, total_price, etc). it is added section on form.

const ps = document.createElement('input');
  ps.type = 'hidden';
  ps.name = 'properties[Pack Size]';
  ps.value = String(packSize);
  const pr = document.createElement('input');
  pr.type = 'hidden';
  pr.name = 'properties[totalPrice]';

  pr.value = String(realtotalPrice);
  form.appendChild(pr);

this is updated section on main-cart-items.liquid

{%- if item.properties["totalPrice"] -%} {{ item.properties["totalPrice"] | money }} {%- else -%} {%- if item.original_line_price != item.final_line_price -%}
{{ 'products.product.price.regular_price' | t }}
{{ item.original_line_price | money }}
{{ 'products.product.price.sale_price' | t }}
{{ item.final_line_price | money }}
{%- else -%} {{ item.original_line_price | money }} {%- endif -%} {%- endif -%}

so I need expert help. Thanks!

shopify cart