Skip to content

Commit

Permalink
Update conditional for restricted_b2b_buying_enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Etchen committed Dec 7, 2023
1 parent c904f7e commit 25a6ad2
Show file tree
Hide file tree
Showing 6 changed files with 698 additions and 568 deletions.
15 changes: 12 additions & 3 deletions sections/featured-product.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
endif
-%}

{% comment %} Temporary for restrict buying to B2B customers only {% endcomment %}
{%- assign shop_restricted_b2b_buying_enabled = true %}

{% comment %} TODO: assign `product.selected_or_first_available_variant` to variable and replace usage to reduce verbosity {% endcomment %}

{%- assign first_3d_model = product.media | where: 'media_type', 'model' | first -%}
Expand Down Expand Up @@ -209,7 +212,10 @@
{{- product.selected_or_first_available_variant.sku -}}
</p>
{%- when 'quantity_selector' -%}
{%- if shop.b2b_customers_enabled != blank -%}
{%- if shop_restricted_b2b_buying_enabled != blank
and shop_restricted_b2b_buying_enabled
and customer.b2b?
-%}
<div
id="Quantity-Form-{{ section.id }}"
class="product-form__input product-form__quantity{% if settings.inputs_shadow_vertical_offset != 0 and settings.inputs_shadow_vertical_offset < 0 %} product-form__quantity-top{% endif %}"
Expand Down Expand Up @@ -453,7 +459,10 @@
update_url: false
%}
{%- when 'buy_buttons' -%}
{%- if shop.b2b_customers_enabled != blank -%}
{%- if shop_restricted_b2b_buying_enabled != blank
and shop_restricted_b2b_buying_enabled
and customer.b2b?
-%}
{%- render 'buy-buttons',
block: block,
product: product,
Expand Down Expand Up @@ -654,7 +663,7 @@
"gtin14": {{ variant.barcode | json }},
{%- endif -%}
"availability" : "http://schema.org/{% if variant.available %}InStock{% else %}OutOfStock{% endif %}",
{%- if shop.b2b_customers_enabled != blank -%}
{%- if shop_restricted_b2b_buying_enabled != blank and shop_restricted_b2b_buying_enabled and customer.b2b? -%}
"price" : {{ variant.price | divided_by: 100.00 | json }},
{%- endif -%}
"priceCurrency" : {{ cart.currency.iso_code | json }},
Expand Down
4 changes: 3 additions & 1 deletion sections/header.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,9 @@
{%- endcase -%}
{%- endfor -%}

{%- if shop.b2b_customers_enabled != blank -%}
{% comment %} Temporary for restrict buying to B2B customers only {% endcomment %}
{%- assign shop_restricted_b2b_buying_enabled = true %}
{%- if shop_restricted_b2b_buying_enabled != blank and shop_restricted_b2b_buying_enabled and customer.b2b? -%}
<a href="{{ routes.cart_url }}" class="header__icon header__icon--cart link focus-inset" id="cart-icon-bubble">
{%- liquid
if cart == empty
Expand Down
Loading

0 comments on commit 25a6ad2

Please sign in to comment.