Hide Stock Quantity

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 года назад
Hi.

Is it possible to hide the stock quantity for guest?

So you have to login before seing our storage level on every items.
4 года назад
It's not possible with default nopCommerce. You need customization here.

StockAvailability = _productService.FormatStockMessage(product, "")
4 года назад
Hi,
instead of customization in code, you can direct check current customer is guest or not in direct view page.

If current customer is guest then do not display stock quantity.
4 года назад
rajupaladiya is it something you can help me with?
4 года назад
[email protected] wrote:
rajupaladiya is it something you can help me with?

Here are changes which you need to in Views\Product\ProductTemplate.Simple.cshtml.
(if you using theme then Themes/<YOURE_THEME_NAME>/Views\Product\ProductTemplate.Simple.cshtml.)

Add this lines at starting point
@using Nop.Core
@using Nop.Core.Domain.Customers
@inject IWorkContext workContext


then replace line -  @await Html.PartialAsync("_Availability", Model) with
 @if (!workContext.CurrentCustomer.IsGuest())
{
              @await Html.PartialAsync("_Availability", Model)
}




Let me know if you get any issue, I'll happy to help you.
4 года назад
Thanks a lot. It worked.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.