Back to Top

Prestashop Hide or Disable Attributes Without Stock

Updated 10 October 2024

Managing an online store with a large number of products can be difficult especially when your product combinations get out of stock.

Product combinations in your store go out of stock for a number of reasons.

Prestashop Hide or Disable Attributes Without Stock facilitates you to hide the out-of-stock product combinations so your customers won’t see the product combinations they cannot purchase.

In default Prestashop, when customers select the product combination, only then they will find out the stock availability and may be able to add to the cart.

When customers find out that the product combination they are looking for is out of stock they will get frustrated and may leave your store without making a purchase.

Searching for an experienced
Prestashop Company ?
Find out More

You can hide or disable the product combinations for more than one country and zones. Also, you can define the date/price range for which the product combinations will be hidden.

NOTE: Prestashop Hide or Disable Attributes Without Stock module is compatible with PrestaShop framework version 8.x.x.

Features of Prestashop Hide or Disable Attributes Without Stock

  • Hide, Disable or show the “Out of Stock” label for the product combinations with zero quantity.
  • Set color for disabled/default (with display “out of stock”) attributes.
  • Option to show Disabled Combination in a different color.
  • Option to hide attributes of non-existing product combinations.
  • Hide product whose stock is zero or below.
  • Configure the date range for which the product combinations will be hidden.
  • Define the price range for which you want to hide the product combinations.
  • Select the products of which you want to hide or disable the product combinations.
  • Select the zones and countries for which the product combinations will be hidden.
  • Hide product combinations for a particular currency or language.
  • Select the attributes that you want to hide or disable.
  • Choose to which group(s) of customers you do not want to show the product combinations.
  • Also, the module is Multishop Compatible.

Installation

  1. Go to back-office ->modules ->Module Manager.
  2. Now, click on “Upload a module” button and select the module’s zip file.
  3. In this way, the module gets install on Prestashop.
Prestashop Hide or Disable Attributes With Stock installation
Prestashop Hide or Disable Attributes With Stock installation
Prestashop Hide or Disable Attributes With Stock installation

Custom Hook Information

On the category page, Prestashop versions 1.7 and 8 uses the Faceted Search module.

If this module is enabled and the version of this module is equal to or higher than 3.0.0, then you have to do add a hook and import 2 classes in this file:

/modules/ps_facetedsearch/src/Adapter/MySQL.php

Add below lines above “use Doctrine\Common\Collections\ArrayCollection;”

use Hook;
use Module;
refer_classes-1-2-png-869×293-

Add this on public function getQuery() method on line no.131

Add this hook

if (Module::isEnabled('wkhideattributes')) { Hook::exec('actionWkHideOutOfStockProduct', array('query' => &$query));}
code

Prestashop Hide or Disable Attributes Without Stock Configuration

General Settings

General Settings

Under General Settings, the admin can:

  • Choose to display out-of-stock, hide or disable attributes of the combinations with 0 quantity.
  • Enable or Disable to hide attributes of the non-existing product combinations.
  • Disable the attributes of out-of-stock product combinations instead of hiding them.
  • Set color for disabled/default (with display “out of stock”) attributes.

Suppose a product combination gets out of stock.

2A


Now, if the admin has selected to “hide” the attributes of out-of-stock combinations from attribute display mode while module configuration.

Then the attribute(s) of product combination with zero quantity will not be displayed at the front end.

not-getting-displayed

As we can see in the above screenshot that the attribute size: S is not visible on the product page.

If the admin selected “Disable” from the attribute display mode while configuring the module.

Then the color of size: S gets changed into “Red color” as we set the color while configuring the module and the customer won’t be able to select the attribute as we can see in below image.

Hide-or-disable-attribute-2

And now, if the admin selected to display the “out of stock” attribute for the combination of the products which have zero quantity.

Then the combinations that have zero quantity in stock shows out of stock in the front of those attribute as shown in the below image.

7-2

Hide product when stock is below or equal to zero

If the admin has enabled this field, then the product whose stock is zero or below will not display.

4-4

Front End View

6-4

Attribute Rule Management

attribute rule management

Under “Attribute Rule Management”, admin can create a hide rule. While creating a rule, admin can select the products to hide using product filters and target of hide products using target filters.

Set-rule-for-disbale-attribute.png

General Information

Under General Information, the admin can set the date range for which he wants to hide the product combinations. Also, the admin can enable or disable the hide rule.

Product Filters

After setting the date range, the admin can select the products to hide using the following filters:

  • Price Range
  • Weight
  • Categories
  • Products
  • Manufacturers
  • Suppliers
  • Attributes
8-1

Target Filters

Under target filters, the admin can choose to which group of customers to whom he does not want to show the product combinations.

Admin can select the zones, countries, currencies, and languages for which the hidden rule will be applicable.

9
  • Minimum order total: Hide rule is applicable for the customers who have placed orders equivalent to or more than the amount specified by admin in this field.
  • Minimum number of orders: Product combinations are not shown to the customers who have placed at least the specified number of orders on the store.

As we can see admin has selected the attribute Size: S while adding a hide rule.

Therefore, customers from selected group(s), zone(s), countries, etc cannot see the attribute(of combination with 0 quantity) on the product page.

1-5-3

Suppose, if a customer selected the French language, then the global configuration will not apply for that customer i.e attribute Size: S will display on the product page.

2-4

Once admin has added the hide rules, then he can view it under “Attribute rule management” tab as show below:

attribute rule management

Support

For any kind of technical assistance or query, please raise a ticket at http://webkul.uvdesk.com or send us a mail at [email protected].

Also, please explore our Prestashop development services and vast range of quality Prestashop addons.

Current Product Version - 4.1.4

Supported Framework Version - 8.x.x, 1.7.x.x

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


2 comments

  • Diego Maravilla
    • Mehul Gupta (Moderator)
  • Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home

    Table of Content