From ce8b382a6d95a49993da555aec84a70b5d7494d5 Mon Sep 17 00:00:00 2001
From: Andrew Etchen
Date: Thu, 7 Dec 2023 18:47:36 -0500
Subject: [PATCH] Update conditional for `restricted_b2b_buying_enabled`
---
sections/featured-product.liquid | 9 ++++++---
sections/header.liquid | 4 +++-
sections/main-product.liquid | 11 +++++++----
snippets/card-product.liquid | 7 +++++--
snippets/meta-tags.liquid | 5 ++++-
snippets/price.liquid | 10 +++++-----
6 files changed, 30 insertions(+), 16 deletions(-)
diff --git a/sections/featured-product.liquid b/sections/featured-product.liquid
index a79d8d86d63..f01907ec765 100644
--- a/sections/featured-product.liquid
+++ b/sections/featured-product.liquid
@@ -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 -%}
@@ -209,7 +212,7 @@
{{- product.selected_or_first_available_variant.sku -}}
{%- when 'quantity_selector' -%}
- {%- if shop.b2b_customers_enabled != blank -%}
+ {%- if shop_restricted_b2b_buying_enabled == false or shop_restricted_b2b_buying_enabled and customer.b2b? -%}
{%- liquid
if cart == empty
diff --git a/sections/main-product.liquid b/sections/main-product.liquid
index 205612a297a..b3a5c47804e 100644
--- a/sections/main-product.liquid
+++ b/sections/main-product.liquid
@@ -41,6 +41,9 @@
{%- endif -%}
+ {% comment %} Temporary for restrict buying to B2B customers only {% endcomment %}
+ {%- assign shop_restricted_b2b_buying_enabled = true %}
+
{%- assign first_3d_model = product.media | where: 'media_type', 'model' | first -%}
{%- if first_3d_model -%}
{{ 'component-product-model.css' | asset_url | stylesheet_tag }}
@@ -207,7 +210,7 @@
{%- when 'quantity_selector' -%}
- {%- if shop.b2b_customers_enabled != blank -%}
+ {%- if shop_restricted_b2b_buying_enabled == false or shop_restricted_b2b_buying_enabled and customer.b2b? -%}
{%- endif -%}
- {%- when 'popup' -%}
+ {%- when 'popup' -%}
- {%- if shop.b2b_customers_enabled != blank -%}
+ {%- if shop_restricted_b2b_buying_enabled == false or shop_restricted_b2b_buying_enabled and customer.b2b? -%}
{%- if card_product.available == false -%}
- {%- if shop.b2b_customers_enabled != blank -%}
+ {%- if shop_restricted_b2b_buying_enabled == false or shop_restricted_b2b_buying_enabled and customer.b2b? -%}
{%- if show_quick_add -%}
{%- liquid
diff --git a/snippets/meta-tags.liquid b/snippets/meta-tags.liquid
index 45ccdcdd3c3..c7dac096c8d 100644
--- a/snippets/meta-tags.liquid
+++ b/snippets/meta-tags.liquid
@@ -26,8 +26,11 @@
{%- endif -%}
+{% comment %} Temporary for restrict buying to B2B customers only {% endcomment %}
+{%- assign shop_restricted_b2b_buying_enabled = true %}
+
{%- if request.page_type == 'product' -%}
- {%- if shop.b2b_customers_enabled != blank -%}
+ {%- if shop_restricted_b2b_buying_enabled == false or shop_restricted_b2b_buying_enabled and customer.b2b? -%}
{%- endif -%}
diff --git a/snippets/price.liquid b/snippets/price.liquid
index 049727cc191..d89ab7c2032 100644
--- a/snippets/price.liquid
+++ b/snippets/price.liquid
@@ -37,7 +37,10 @@
endif
-%}
-{%- 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 == false or shop_restricted_b2b_buying_enabled and customer.b2b? -%}
{{ 'products.product.price.regular_price' | t }}
- {{-
- 'products.product.volume_pricing.price_range'
- | t: minimum: money_price_min, maximum: money_price_max
- -}}
+ {{- 'products.product.volume_pricing.price_range' | t: minimum: money_price_min, maximum: money_price_max -}}
{%- else -%}
{{ 'products.product.price.regular_price' | t }}