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

[B2B] Restrict pricing #3144

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

[B2B] Restrict pricing #3144

wants to merge 8 commits into from

Conversation

andrewetchen
Copy link
Contributor

@andrewetchen andrewetchen commented Dec 7, 2023

What approach did you take?

I used the following conditional to hide pricing and buying functions:

{%- if shop_restricted_b2b_buying_enabled == false or shop_restricted_b2b_buying_enabled and customer.b2b? -%}
  …
{%- endif -%}

This conditional checks if shop_restricted_b2b_buying_enabled is false or if shop_restricted_b2b_buying_enabled is true 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):

{%- assign shop_restricted_b2b_buying_enabled = true %}

Assuming the new shop_restricted_b2b_buying_enabled setting won't even return nil and just true or false, 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 the price.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 and ShopifyAnalytics: 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:

  • Product cards
    • Collection templates
    • Main search results
    • Featured Collection section
    • Collage section
    • Complementary products block
    • Related/recommended products section
    • Predictive search product results (setting screenshot)
    • Sale and Sold out badges
    • Cart notification? Could buyers try to show such a component and get insights of a price?
    • Pricing filters ⚠️ pending
  • Meta property for price
  • Product page templates (Price block)
    • Product schema price in the DOM (dev tools)
  • Featured product section
    • Product schema price in the DOM (dev tools)

Buying functions that shouldn't be present for non-B2B customers:

  • Quick add buttons on Product cards
    • Collection templates
    • Featured Collection section
    • Complementary products block
  • Cart icon in header: ⚠️ icon spacing pending
  • Buy Buttons on PDP and (Featured Product section)
  • Quantity Pickers on PDP (and Featured Product section)
  • Quick Order List on PDP (entire section): ⚠️ pending

Demo links

Copy link

@SelenaJL SelenaJL left a 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:

  1. The restricted_buying_enabled flag is true and the customer is logged in as B2B
  2. 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!

@tyleralsbury
Copy link
Contributor

@andrewetchen @dan-menard is this still a relevant PR for b2b?

@dan-menard
Copy link
Member

Yes, we're still planning on shipping this feature, eventually. The timeline is delayed, but will still leverage this work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants