Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Volume Pricing and Qty Rules Popover to Quick Add Bulk Input #3393

Merged
merged 9 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions assets/component-card.css
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,34 @@
color: rgba(var(--color-foreground), 0.75);
}

.card__information-volume-pricing-note--button {
position: relative;
z-index: 1;
cursor: pointer;
padding: 0;
margin: 0;
}

.card__information-volume-pricing-note--button:hover {
text-decoration: underline;
}

.card__information-volume-pricing-note--button + .global-settings-popup.quantity-popover__info {
transform: initial;
top: auto;
bottom: 3.5rem;
}

.card-information quantity-popover volume-pricing {
margin-top: 4.2rem;
}

@media screen and (min-width: 990px) {
.card-information quantity-popover volume-pricing {
margin-top: 0;
}
}

@media screen and (min-width: 750px) {
.card__information {
padding-bottom: 1.7rem;
Expand Down Expand Up @@ -370,6 +398,11 @@
margin-top: 0.4rem;
}

/* Specificity needed due to the changes below */
.card-information > *:not(.visually-hidden:first-child) + quantity-popover:not(.rating):not(.card__information-volume-pricing-note), .card-information .card__information-volume-pricing-note.card__information-volume-pricing-note--button {
margin-top: 0;
}

.card-information>*:not(.visually-hidden:first-child)+*:not(.rating):not(.card__information-volume-pricing-note) {
margin-top: 0.7rem;
}
Expand Down
90 changes: 87 additions & 3 deletions snippets/card-product.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,93 @@

{% render 'price', product: card_product, price_class: '', show_compare_at_price: true %}
{%- if card_product.quantity_price_breaks_configured? -%}
<div class="card__information-volume-pricing-note">
<span class="caption">{{ 'products.product.volume_pricing.note' | t }}</span>
</div>
{% if card_product.variants.size == 1 and quick_add == 'bulk' %}
{% liquid
assign has_qty_rules = false
if variant.quantity_rule.increment > 1 or variant.quantity_rule.min > 1 or variant.quantity_rule.max != null
assign has_qty_rules = true
endif
%}
<quantity-popover>
<button class="card__information-volume-pricing-note card__information-volume-pricing-note--button quantity-popover__info-button--icon-only button button button--tertiary medium-hide small-hide">
<span class="caption">{{ 'products.product.volume_pricing.note' | t }}</span>
</button>
<button class="card__information-volume-pricing-note card__information-volume-pricing-note--button quantity-popover__info-button--icon-with-label button button--tertiary large-up-hide">
<span class="caption">{{ 'products.product.volume_pricing.note' | t }}</span>
</button>
{% else %}
<div class="card__information-volume-pricing-note">
<span class="caption">{{ 'products.product.volume_pricing.note' | t }}</span>
</div>
{% endif %}
{% if card_product.variants.size == 1 and quick_add == 'bulk' %}
<div
class="global-settings-popup quantity-popover__info"
tabindex="-1"
hidden
id="quantity-popover-info-{{ card_product.selected_or_first_available_variant.id }}"
>
{%- if has_qty_rules -%}
<div class="quantity__rules caption no-js-hidden">
{%- if card_product.selected_or_first_available_variant.quantity_rule.increment > 1 -%}
<span class="divider">
{{-
'products.product.quantity.multiples_of'
| t: quantity: card_product.selected_or_first_available_variant.quantity_rule.increment
-}}
</span>
{%- endif -%}
{%- if variant.quantity_rule.min > 1 -%}
<span class="divider">
{{-
'products.product.quantity.min_of'
| t: quantity: card_product.selected_or_first_available_variant.quantity_rule.min
-}}
</span>
{%- endif -%}
{%- if variant.quantity_rule.max != null -%}
<span class="divider">
{{-
'products.product.quantity.max_of'
| t: quantity: card_product.selected_or_first_available_variant.quantity_rule.max
-}}
</span>
{%- endif -%}
</div>
{%- endif -%}
<button
class="button-close button button--tertiary large-up-hide"
type="button"
aria-label="{{ 'accessibility.close' | t }}"
>
{%- render 'icon-close' -%}
</button>
{%- if card_product.selected_or_first_available_variant.quantity_price_breaks.size > 0 -%}
<volume-pricing class="parent-display">
<ul class="list-unstyled">
<li>
<span>{{ card_product.selected_or_first_available_variant.quantity_rule.min }}+</span>
{%- assign price = card_product.selected_or_first_available_variant.price
| money_with_currency
-%}
<span>{{ 'sections.quick_order_list.each' | t: money: price }}</span>
</li>
{%- for price_break in card_product.selected_or_first_available_variant.quantity_price_breaks -%}
<li>
<span>
{{- price_break.minimum_quantity -}}
<span aria-hidden="true">+</span></span
>
{%- assign price = price_break.price | money_with_currency -%}
<span> {{ 'sections.quick_order_list.each' | t: money: price }}</span>
</li>
{%- endfor -%}
</ul>
</volume-pricing>
{%- endif -%}
</div>
</quantity-popover>
{% endif %}
{%- endif -%}
</div>
</div>
Expand Down Expand Up @@ -424,12 +508,12 @@
</div>
{%- endif -%}
</div>
{%- render 'quick-order-list',
product: card_product,
show_image: true,
show_sku: true,
is_modal: true
-%}

Check warning on line 516 in snippets/card-product.liquid

View workflow job for this annotation

GitHub Actions / Theme Check Report

snippets/card-product.liquid#L511-L516

[NestedSnippet] Too many nested snippets

Check warning on line 516 in snippets/card-product.liquid

View workflow job for this annotation

GitHub Actions / Theme Check Report

snippets/card-product.liquid#L511-L516

[NestedSnippet] Too many nested snippets

Check warning on line 516 in snippets/card-product.liquid

View workflow job for this annotation

GitHub Actions / Theme Check Report

snippets/card-product.liquid#L511-L516

[NestedSnippet] Too many nested snippets

Check warning on line 516 in snippets/card-product.liquid

View workflow job for this annotation

GitHub Actions / Theme Check Report

snippets/card-product.liquid#L511-L516

[NestedSnippet] Too many nested snippets

Check warning on line 516 in snippets/card-product.liquid

View workflow job for this annotation

GitHub Actions / Theme Check Report

snippets/card-product.liquid#L511-L516

[NestedSnippet] Too many nested snippets

Check warning on line 516 in snippets/card-product.liquid

View workflow job for this annotation

GitHub Actions / Theme Check Report

snippets/card-product.liquid#L511-L516

[NestedSnippet] Too many nested snippets
</div>
</div>
</div>
Expand Down
Loading