-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[B2B] Restrict pricing #3144
base: main
Are you sure you want to change the base?
[B2B] Restrict pricing #3144
Conversation
25a6ad2
to
baffedd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for iterating on the conditional after our last discussion 😄
We want to show buying functions in two cases:
- The
restricted_buying_enabled
flag istrue
and the customer is logged in as B2B - The
restricted_buying_enabled
flag is false
I believe the current conditional (if shop_restricted_b2b_buying_enabled != blank and shop_restricted_b2b_buying_enabled and customer.b2b?
) only accounts for the first case, right? Let me know if I missed something!
baffedd
to
ce8b382
Compare
@andrewetchen @dan-menard is this still a relevant PR for b2b? |
Yes, we're still planning on shipping this feature, eventually. The timeline is delayed, but will still leverage this work. |
What approach did you take?
I used the following conditional to hide pricing and buying functions:
This conditional checks if
shop_restricted_b2b_buying_enabled
isfalse
or ifshop_restricted_b2b_buying_enabled
istrue
and the customer is a B2B customer.I added a temporary assignment variable (
shop_restricted_b2b_buying_enabled
) to simulate the behaviour of the upcoming API setting in order to prototype conditional logic for displaying prices and buying functions for B2B customers (this will be removed later):Assuming the new
shop_restricted_b2b_buying_enabled
setting won't even returnnil
and justtrue
orfalse
, I'm omitting the check against!= blank
.Other considerations
For the product cards, using the conditional above, I wrapped the price element in the
price.liquid
snippet. Instead, we may decide to add this conditional to each and every section but for now, I just added it to theprice.liquid
snippet for the simplicity of this prototype.I hid the prices from the price meta property and schema price on the product page and featured product section. This is normally revealed in the DOM (screenshot 1, screenshot 2). However, prices are still shown in the DOM (Chome dev tools > search for
web-pixels-manager-setup
andShopifyAnalytics
: screenshot 1, screenshot 2) but this isn't controlled in the theme 🤔Testing steps/scenarios
Hide whitespace when reviewing code.
Places where pricing should be hidden for non-B2B customers:
Buying functions that shouldn't be present for non-B2B customers:
Demo links