Logo video2dn
  • Сохранить видео с ютуба
  • Категории
    • Музыка
    • Кино и Анимация
    • Автомобили
    • Животные
    • Спорт
    • Путешествия
    • Игры
    • Люди и Блоги
    • Юмор
    • Развлечения
    • Новости и Политика
    • Howto и Стиль
    • Diy своими руками
    • Образование
    • Наука и Технологии
    • Некоммерческие Организации
  • О сайте

Скачать или смотреть How to Hide Prices on BigCommerce Product Pages Based on User Login Status and Custom Fields

  • vlogize
  • 2025-04-14
  • 8
How to Hide Prices on BigCommerce Product Pages Based on User Login Status and Custom Fields
Trouble Displaying a Product's Price in Stencil Conditional Statementbigcommerce
  • ok logo

Скачать How to Hide Prices on BigCommerce Product Pages Based on User Login Status and Custom Fields бесплатно в качестве 4к (2к / 1080p)

У нас вы можете скачать бесплатно How to Hide Prices on BigCommerce Product Pages Based on User Login Status and Custom Fields или посмотреть видео с ютуба в максимальном доступном качестве.

Для скачивания выберите вариант из формы ниже:

  • Информация по загрузке:

Cкачать музыку How to Hide Prices on BigCommerce Product Pages Based on User Login Status and Custom Fields бесплатно в формате MP3:

Если иконки загрузки не отобразились, ПОЖАЛУЙСТА, НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если у вас возникли трудности с загрузкой, пожалуйста, свяжитесь с нами по контактам, указанным в нижней части страницы.
Спасибо за использование сервиса video2dn.com

Описание к видео How to Hide Prices on BigCommerce Product Pages Based on User Login Status and Custom Fields

Learn how to control the display of product prices on BigCommerce for different user scenarios, ensuring a tailored shopping experience.
---
This video is based on the question https://stackoverflow.com/q/68506013/ asked by the user 'Jon Morgan' ( https://stackoverflow.com/u/16488754/ ) and on the answer https://stackoverflow.com/a/68547028/ provided by the user 'Matt Coy' ( https://stackoverflow.com/u/15078632/ ) at 'Stack Overflow' website. Thanks to these great users and Stackexchange community for their contributions.

Visit these links for original content and any more details, such as alternate solutions, latest updates/developments on topic, comments, revision history etc. For example, the original title of the Question was: Trouble Displaying a Product's Price in Stencil Conditional Statement

Also, Content (except music) licensed under CC BY-SA https://meta.stackexchange.com/help/l...
The original Question post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/... ) license, and the original Answer post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/... ) license.

If anything seems off to you, please feel free to write me at vlogize [AT] gmail [DOT] com.
---
Trouble Displaying a Product's Price in Stencil Conditional Statement

If you're running an online store and using BigCommerce’s Cornerstone theme, you may run into the challenge of selectively hiding product prices based on the user's login status. This is particularly important if you want to restrict visibility for certain items while allowing registered customers to see all prices.

A common scenario involves using a custom field, such as HidePrice, which can be set to either true or false for different products. In this guide, we will break down how to manage this functionality effectively.

The Challenge

The user had the following requirements:

Logged-In Users: Always show prices regardless of the HidePrice value.

Public Users with HidePrice = false: Display the product's price.

Public Users with HidePrice = true: Suppress the price and show a message, "Too low to show".

However, the initial code provided didn't work as expected for situation # 1, which leads us to investigate further.

Understanding the Issue

The main problem lies in the scope of the conditional statements used in the Stencil template. When you create a filter to examine a product's custom fields, you shift the context from the global scope (where the product details, like price, are available) to a more restricted scope that only recognizes the custom fields. This means that access to the original product object is lost, which results in the price not displaying as intended.

The Solution

To solve this problem, you simply need to adjust how you reference the product price when you're inside the filtered block of code. Here’s how to implement the fix:

Updated Code Block

[[See Video to Reveal this Text or Code Snippet]]

Code Breakdown

Account for User Login:

If the user is logged in ({{# if customer}}), display the product price if it can be purchased.

Check for Custom Field:

For guests (not logged in), check the custom field HidePrice using the filter.

Retrieve Price Correctly:

Use {{../product.price.without_tax.value}} instead of {{product.price.without_tax.value}} when you are within a filtered scope.

Benefits of This Approach

Flexibility: You can easily manage which products display prices based on custom criteria.

User Experience: This allows you to control what guests see, potentially enhancing the conversion rates by enticing registered users.

Conclusion

By correctly managing the scope within your BigCommerce Stencil templates, you can successfully display or hide product prices based on user login status and specific product attributes. This capability not only improves the user experience but also aligns with common retail strategies that cater to registered users.

Incorporating these techniques will help you build a more engaging and responsive shopping environment. If you run into further challenges, don’t hesitate to ask for help in the BigCommerce community!

Комментарии

Информация по комментариям в разработке

Похожие видео

  • О нас
  • Контакты
  • Отказ от ответственности - Disclaimer
  • Условия использования сайта - TOS
  • Политика конфиденциальности

video2dn Copyright © 2023 - 2025

Контакты для правообладателей [email protected]