fpsvogel

Debutify cart.liquid edited for DP compatibility

Sep 27th, 2021
605
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 19.26 KB | None | 0 0
  1. {%- assign total_compare_at_price = 0 -%}
  2.  
  3. <div class="box">
  4.   <div class="wrapper">
  5.  
  6.     <div class="grid">
  7.       <div class="grid__item large--eight-twelfths push--large--two-twelfths">
  8.         <div class="section-header">
  9.           <div class="page-title-wrapper">
  10.             <h1 class="page-title">{{ 'cart.general.title' | t }}</h1>
  11.           </div>
  12.         </div>
  13.  
  14.         {%- if cart.item_count == 0 -%}
  15.           <div class="page-empty">
  16.             <p class="cart--empty-message">{{ 'cart.general.empty' | t }}</p>
  17.             <p class="cookie-message">{{ 'cart.general.cookies_required' | t }}</p>
  18.             <a href="{{ settings.browsing_link }}" class="btn btn--primary">{{ 'cart.general.continue_browsing_html' | t }}</a>
  19.           </div>
  20.         {%- endif -%}
  21.       </div>
  22.     </div>
  23.  
  24.     {%- if cart.item_count > 0 -%}
  25.       <form id="cartForm"
  26.            class="cart-form"
  27.            action="{{ routes.cart_url }}"
  28.            method="post"
  29.            novalidate>
  30.  
  31.         <div class="grid grid-spacer">
  32.           <div class="grid__item medium--six-twelfths large--seven-twelfths dbtfy_main_cart_container">
  33.             {%- render 'dbtfy-cart-countdown', position: 'cart_page' -%}
  34.  
  35.             <div class="card-group cart-products">
  36.               {%- for item in cart.items -%}
  37.                 {%- if item.variant.compare_at_price > 0 -%}
  38.                   {%- assign total_compare_at_price = item.variant.compare_at_price | times: item.quantity | plus: total_compare_at_price -%}
  39.                 {%- else -%}
  40.                   {%- assign total_compare_at_price = item.variant.price | times: item.quantity | plus: total_compare_at_price -%}
  41.                 {%- endif -%}
  42.  
  43.                 {%- if item.original_line_price != item.final_line_price -%}
  44.                   {%- assign has_discount = true -%}
  45.                 {%- else -%}
  46.                   {%- assign has_discount = false -%}
  47.                 {%- endif -%}
  48.  
  49.                 {%- if item.variant.compare_at_price > item.variant.price -%}
  50.                   {%- assign on_sale = true -%}
  51.                 {%- else -%}
  52.                   {%- assign on_sale = false -%}
  53.                 {%- endif -%}
  54.  
  55.                 <div class="cart__row cart-item card"
  56.                     data-product-handle="{{ item.product.handle }}"
  57.                     data-product-id="{{ item.product.id }}"
  58.                     data-line="{{ forloop.index }}">
  59.  
  60.                   <div class="card-body">
  61.                     <div class="grid grid-small cart__grid {% if has_discount or on_sale %}cart__product-has-discount{% endif %}">
  62.                       <div class="grid__item large--three-twelfths medium--four-twelfths small--four-twelfths">
  63.                         <a href="{{ item.url | within: collections.all }}" class="product--wrapper cart__image media-wrapper image-link" style="padding-top:{{ 1 | divided_by: item.image.aspect_ratio | times: 100 }}%;">
  64.                           <img class="product--image media lazyload"
  65.                              {% render 'lazysizes', img: item.image, img_type: 'responsive' %}
  66.                               alt="{{ item.title | escape }}">
  67.                         </a>
  68.                       </div>
  69.  
  70.                       <div class="grid__item large--nine-twelfths medium--eight-twelfths small--eight-twelfths flex flex-column justify-center">
  71.                         <div class="cart__item-meta spacer-auto-xs">
  72.  
  73.                           <div class="cart__product-name h6 flex justify-between spacer-bottom-xs">
  74.                             <a href="{{ item.url }}" class="text-ellipsis">{{ item.product.title }}
  75. <span class='booster-cart-item-success-notes' data-key='{{item.key}}'></span><span class='booster-cart-item-upsell-notes' data-key='{{item.key}}'></span></a>
  76.                             <a class="cart__product-remove" href="{{ routes.cart_change_url }}?line={{ forloop.index }}&amp;quantity=0" aria-label="{{ 'cart.general.remove' | t }}" title="{{ 'cart.general.remove' | t }}">
  77.                               <div class="btn__text">
  78.                                 <span class="{{settings.icon}}" aria-hidden="true">delete</span>
  79.                               </div>
  80.                             </a>
  81.                           </div>
  82.  
  83.                           {%- unless item.variant.title contains 'Default' -%}
  84.                             <p class="cart__product-variant text-small">
  85.                               {{ item.variant.title }}
  86.                             </p>
  87.                           {%- endunless -%}
  88.  
  89.                           {%- assign property_size = item.properties | size -%}
  90.                           {%- if property_size > 0 -%}
  91.                             {%- for p in item.properties -%}
  92.                               {%- assign first_character_in_key = p.first | truncate: 1, '' -%}
  93.                               {%- unless p.last == blank or first_character_in_key == '_' -%}
  94.                                 <div class="cart__product-properties text-small">
  95.                                   {{- p.first | append: ':' | append: ' ' -}}
  96.                                   {%- if p.last contains '/uploads/' -%}
  97.                                     <a href="{{ p.last }}">{{ p.last | split: '/' | last }}</a>
  98.                                   {%- else -%}
  99.                                     {{- p.last -}}
  100.                                   {%- endif -%}
  101.                                 </div>
  102.                               {%- endunless -%}
  103.                             {%- endfor -%}
  104.                           {%- endif -%}
  105.                         </div>
  106.  
  107.                         {%- if item.line_level_discount_allocations != blank -%}
  108.                           <div class="grid grid-small">
  109.                             {%- for discount_allocation in item.line_level_discount_allocations -%}
  110.                               <div class="grid__item six-twelfths">
  111.                                 <p class="product-discount text-secondary" aria-label="{{ 'customer.order.discount' | t }}">
  112.                                   <span class="{{settings.icon}}" aria-hidden="true">local_offer</span>
  113.                                   <span class="visually-hidden">{{ 'customer.order.discount' | t }}:</span>
  114.                                   {{ discount_allocation.discount_application.title }}
  115.                                 </p>
  116.                               </div>
  117.                               <div class="grid__item six-twelfths text-right">
  118.                                 <p class="product-discount text-sale">-<span class="money">{{ discount_allocation.amount | money }}</span></p>
  119.                               </div>
  120.                             {%- endfor -%}
  121.                           </div>
  122.                         {%- endif -%}
  123.  
  124.                         <div class="grid grid-small flex-nowrap align-center spacer-top-xs">
  125.                           <div class="grid__item flex-auto">
  126.                             {%- assign quantity_id = 'updates_' | append: item.key -%}
  127.  
  128.                             <label for="{{ quantity_id }}" class="visually-hidden">{{ 'cart.label.quantity' | t }}</label>
  129.                             {%- render 'quantity-selector' with item as item, type: 'cart', id: quantity_id -%}
  130.                           </div>
  131.  
  132.                           <div class="grid__item flex-fill cart__price-wrapper text-right text-money">
  133.                             {% comment %}
  134.                             <!-- THE ORIGINAL THEME CODE, replaced with the lines below ("edits by Booster Apps") -->
  135.                             {%- if has_discount -%}
  136.                               <span class="cart__price text-sale" aria-label="{{ 'products.general.sale_price' | t }}"><span class="money">{{ item.final_line_price | money }}</span></span>
  137.                               <span class="cart__price cart__price--compare text-muted text-strike" aria-label="{{ 'products.general.regular_price' | t }}"><span class="money">{{ item.original_line_price | money }}</span></span>
  138.                             {%- elsif on_sale -%}
  139.                               <span class="cart__price text-sale" aria-label="{{ 'products.general.sale_price' | t }}"><span class="money">{{ item.variant.price | times: item.quantity | money }}</span></span>
  140.                               <span class="cart__price cart__price--compare text-muted text-strike" aria-label="{{ 'products.general.regular_price' | t }}"><span class="money">{{ item.variant.compare_at_price | times: item.quantity | money }}</span></span>
  141.                             {% else %}
  142.                               <span class="cart__price" aria-label="{{ 'products.general.regular_price' | t }}"><span class="money">{{ item.original_line_price | money }}</span></span>
  143.                             {%- endif -%}
  144.                             {% endcomment %}
  145.                            
  146.                             <!-- EDITS BY BOOSTER APPS, added for Discounted Pricing compatibility on 13 Sept. 2021 -->
  147.                             {%- if has_discount -%}
  148.                               <span class="cart__price cart__price--compare text-muted text-strike" aria-label="{{ 'products.general.regular_price' | t }}"><span class="money">{{ item.original_line_price | money }}</span></span>
  149.                               <span class="cart__price text-sale" aria-label="{{ 'products.general.sale_price' | t }}"><span class="money"><span class='booster-cart-item-line-price' data-key='{{item.key}}'>{{ item.final_line_price | money }}</span></span></span>
  150.                             {%- elsif on_sale -%}
  151.                               <span class="cart__price cart__price--compare text-muted text-strike" aria-label="{{ 'products.general.regular_price' | t }}"><span class="money">{{ item.variant.compare_at_price | times: item.quantity | money }}</span></span>
  152.                               <span class="cart__price text-sale" aria-label="{{ 'products.general.sale_price' | t }}"><span class="money"><span class='booster-cart-item-line-price' data-key='{{item.key}}'>{{ item.variant.price | times: item.quantity | money }}</span></span></span>
  153.                             {% else %}
  154.                               <span class="cart__price" aria-label="{{ 'products.general.regular_price' | t }}"><span class="money"><span class='booster-cart-item-line-price' data-key='{{item.key}}'>{{ item.original_line_price | money }}</span></span></span>
  155.                             {%- endif -%}
  156.                             <!-- END of edits by Booster Apps -->
  157.  
  158.                             {%- if item.unit_price_measurement -%}
  159.                               <span class="visually-hidden">{{ 'products.general.unit_price' | t }}</span>
  160.                               <span class="cart__unit-price">
  161.                             {%- capture unit_price_separator -%}
  162.                               <span aria-hidden="true">/</span><span class="visually-hidden">&nbsp;{{ 'general.accessibility.unit_price_separator' | t }}&nbsp;</span>
  163.                             {%- endcapture -%}
  164.                                 {%- capture unit_price_base_unit -%}
  165.                                   {%- if item.unit_price_measurement.reference_value != 1 -%}
  166.                                     {{- item.unit_price_measurement.reference_value -}}
  167.                                   {%- endif -%}
  168.                                   {{ item.unit_price_measurement.reference_unit }}
  169.                                 {%- endcapture -%}
  170.                             <span data-unit-price><span class="money">{{ item.unit_price | money }}</span></span>{{- unit_price_separator -}}{{- unit_price_base_unit -}}
  171.                           </span>
  172.                             {%- endif -%}
  173.                           </div>
  174.                         </div>
  175.                       </div>
  176.                     </div>
  177.                   </div>
  178.                 </div>
  179.               {%- endfor -%}
  180.             </div>
  181.  
  182.             {%- render "dbtfy-cart-discount", position: "cart_page" -%}
  183.  
  184.             {%- if settings.cart_notes_enable -%}
  185.               <div class="cart__row card spacer-top">
  186.                 <div class="cart__note card-body">
  187.                   <label for="CartSpecialInstructions">
  188.                     <span class="{{ settings.icon }} icon-width" aria-hidden="true">info</span>
  189.                     {{ 'cart.general.note' | t }}
  190.                   </label>
  191.                   <textarea rows="3" name="note" class="input-full" id="CartSpecialInstructions">{{ cart.note }}</textarea>
  192.                 </div>
  193.               </div>
  194.             {%- endif -%}
  195.  
  196.             {%- assign currency_message =  'cart.general.custom_currency_html' | t: shopCurrency: shop.currency -%}
  197.  
  198.             {%- if content_for_header contains 'debutify' and settings.dbtfy_custom_currencies and currency_message != blank -%}
  199.               <div class="cart__row card spacer-top Cart_currencyinfo">
  200.                 <div class="card-body">
  201.                   <p>{{ currency_message }}</p>
  202.                 </div>
  203.               </div>
  204.             {%- endif -%}
  205.  
  206.             {%- render 'dbtfy-order-feedback' -%}
  207.           </div>
  208.  
  209.           <div class="grid__item medium--six-twelfths large--five-twelfths cart__right-item">
  210.             <div class="card large--sticky medium--sticky sticky-check-header">
  211.               <div class="card-body">
  212.                 {%- if cart.cart_level_discount_applications != blank -%}
  213.                   {%- for discount_application in cart.cart_level_discount_applications -%}
  214.                     <div class="grid grid-small">
  215.                       <div class="grid__item six-twelfths">
  216.                         <p class="order-discount">
  217.                           <span class="{{settings.icon}}" aria-hidden="true">local_offer</span>
  218.                           <span class="visually-hidden">{{ 'customer.order.discount' | t }}:</span>
  219.                           {{- discount_application.title -}}
  220.                         </p>
  221.                       </div>
  222.                       <div class="grid__item six-twelfths text-right">
  223.                         <p class="order-discount">-<span class="money">{{ discount_application.total_allocated_amount | money }}</span></p>
  224.                       </div>
  225.                     </div>
  226.                   {%- endfor -%}
  227.                 {%- endif -%}
  228.                
  229.                 {% comment %}
  230.                 <!-- THE ORIGINAL THEME CODE, replaced with the lines below ("edits by Booster Apps") -->
  231.                 <div class="cart__total-price-info spacer-bottom-sm">
  232.                   <div class="grid grid-small flex-nowrap cart__subtotal-wrapper">
  233.                     <div class="grid__item flex-fill overflow-hidden">
  234.                       <p class="cart__subtotal text-money spacer-bottom-none text-large text-ellipsis">{{ 'cart.general.subtotal' | t }}</p>
  235.                     </div>
  236.                     <div class="grid__item flex-auto text-right">
  237.                       <p class="cart__subtotal text-money spacer-bottom-none text-large" data-cart-total><span class="money">{{ cart.total_price | money }}</span></p>
  238.                     </div>
  239.                   </div>
  240.  
  241.                   {%- render "dbtfy-cart-savings", cart: cart, total_compare_at_price: total_compare_at_price -%}
  242.                 </div>
  243.                 {% endcomment %}
  244.                
  245.                 <!-- EDITS BY BOOSTER APPS, added for Discounted Pricing compatibility on 13 Sept. 2021 -->
  246.                 <div class="cart__total-price-info spacer-bottom-sm">
  247.                   <div class="grid grid-small flex-nowrap cart__subtotal-wrapper">
  248.                     <div class="grid__item flex-fill overflow-hidden">
  249.                       <p class="cart__subtotal text-money spacer-bottom-none text-large text-ellipsis">{{ 'cart.general.subtotal' | t }}</p>
  250.                     </div>
  251.                     <div class="grid__item flex-auto text-right">
  252.                       <span class="wh-original-cart-total">{{ cart.total_price | money }}</span><span class="wh-cart-total"></span><div class="additional-notes"><span class="wh-minimums-note"></span><span class="wh-extra-note"></span></div>
  253.                     </div>
  254.                   </div>
  255.  
  256.                   {% comment %}{%- render "dbtfy-cart-savings", cart: cart, total_compare_at_price: total_compare_at_price -%}{% endcomment %}
  257.                 </div>
  258.                 <!-- END of edits by Booster Apps -->
  259.                
  260.  
  261.                 {%- render "dbtfy-agree-to-terms" -%}
  262.  
  263.                 {%- capture taxes_shipping_checkout -%}
  264.                   {%- if shop.taxes_included and shop.shipping_policy.body != blank -%}
  265.                     {{ 'cart.general.taxes_included_and_shipping_policy_html' | t: link: shop.shipping_policy.url }}
  266.                     {%- elsif shop.taxes_included -%}
  267.                     {{ 'cart.general.taxes_included_but_shipping_at_checkout' | t }}
  268.                     {%- elsif shop.shipping_policy.body != blank -%}
  269.                     {{ 'cart.general.taxes_and_shipping_policy_at_checkout_html' | t: link: shop.shipping_policy.url }}
  270.                   {%- else -%}
  271.                     {{ 'cart.general.taxes_and_shipping_at_checkout' | t }}
  272.                   {%- endif -%}
  273.                 {%- endcapture -%}
  274.               </div>
  275.  
  276.               <div class="card-footer">
  277.                 {%- if taxes_shipping_checkout != blank -%}
  278.                   <p class="cart__policies text-center text-small rte">
  279.                     {{ taxes_shipping_checkout }}
  280.                   </p>
  281.                 {%- endif -%}
  282.  
  283.                 <button type="submit" name="checkout" class="btn btn--primary full cart__checkout">
  284.                   <span class="btn__text">
  285.                     {% unless settings.checkout_icon == blank %}
  286.                       <span class="{{settings.icon}}" aria-hidden="true">{{ settings.checkout_icon }}</span>
  287.                     {% endunless %}
  288.  
  289.                     {{ 'cart.general.checkout' | t }}
  290.  
  291.                     {% comment %}
  292.                     {%- if settings.cart_count_checkout -%}
  293.                       (<span class="cart-count">{{ cart.item_count }}</span>)
  294.                     {%- endif -%}
  295.                     {% endcomment %}
  296.  
  297.                     {% comment %}
  298.                     {%- if settings.cart_cost_checkout -%}
  299.                       – <span class="cart-cost" data-cart-total-value><span class="money"><span class="wh-original-cart-total"><span class='wh-original-price'>{{ cart.total_price | money }}</span></span><span class="wh-cart-total"></span><div class="additional-notes"><span class="wh-minimums-note"></span><span class="wh-extra-note"></span></div></span></span>
  300.                     {%- endif -%}
  301.                     {% endcomment %}
  302.                   </span>
  303.                 </button>
  304.  
  305.                 {%- unless request.design_mode -%}
  306.                   {%- if additional_checkout_buttons and settings.enable_payment_button and settings.position != 'drawer' -%}
  307.                     <div class="additional_checkout_buttons" {% if settings.dbtfy_agree_to_terms %}hidden{% endif %}>{{ content_for_additional_checkout_buttons }}</div>
  308.                   {%- endif -%}
  309.                 {%- endunless -%}
  310.  
  311.                 {%- render "dbtfy-trust-badge", position: "cart_page" -%}
  312.               </div>
  313.             </div>
  314.           </div>
  315.         </div>
  316.       </form>
  317.     {%- endif -%}
  318.  
  319.   </div>
  320. </div>
Advertisement
Add Comment
Please, Sign In to add comment