Back to Top

PrestaShop Sample Product {User Guide}

Updated 5 March 2024

PrestaShop Sample Product: Attract customers’ attention towards your product listings by offering product samples. Let customers order samples and try your products before making the actual purchase.

  • Charge for product samples or offer them for free.
  • Four different ways to set the price of a sample product.
  • Restrict samples for specific products.
  • Restrict the quantity that customers can order for product samples.
  • Allow/Restrict guest users to order product samples.
  • Offer samples for virtual products.

Features of PrestaShop Sample Product

  • Provide a sample of your existing products to customers.
  • Customers can try a product before purchasing it.
  • Admin can allow/restrict the guest users to buy sample products.
  • Either define a price for your sample products or offer free samples.
  • Limit the number of samples a customer can purchase.
  • Choose to show or hide the quantity selector for the sample product.
  • Assign weight and carriers to the sample products.
  • Assign sample products in bulk.
  • Admin can choose to follow the particular settings or global settings while enabling the offering sample for a particular product.
  • Customize the text and the background color of the ‘buy sample’ button.
  • Now, customers can order samples of any combination of the product.
  • Configure global settings to offer a sample of all the products in the catalog.
  • Enable/disable tax on the purchase of a sample product.
  • Offer samples for virtual products too.
  • Upload another file for a sample virtual product for preview.
  • The main product can not be added while its sample is already in the cart.
  • A new label to notify sample products will show in the cart.
  • Buyers can even choose the quantity of sample products.

How to install PrestaShop Sample Product module

  • Firstly, Go to the Module Manager in the Back office and click on “upload a module”.
  • After that, Drag and drop the module file or select the file from the system.
  • In this way, the module installation will be successful.


1) PrestaShop Sample Product module is compatible with PrestaShop version 8.x.x and multi-store feature..

2) To enable selling of sample of virtual products, add a new custom Hook in init() function of /controllers/front/GetFileController.php for downloading virtual product sample.

For PrestaShop version below, add hook before the line – $mimeType = false;

For PrestaShop version and above, add hook before the line – $this->sendFile($file, $filename);

Searching for an experienced
Prestashop Company ?
Find out More

Add this code

HOOK::exec('actionSampleProductDownloadBefore', array($info, &$file, &$filename));
if (!$filename) {
    <script type="text/javascript">
        alert("<?php echo $file ?>");

3) If you want to ignore “Minimum quantity for sale” for sample products then add a new custom hook in /classes/Cart.php::updateQty() for adding sample quantity less than product minimum quantity
Replace the code –

if ((int)$quantity < $minimal_quantity) {
    return -1;

With –

if ((int)$quantity < $minimal_quantity) {
    $sampleProductHook = Hook::exec('actionSampleProductAddInCart', array('idProduct' => $id_product));
    if (!$sampleProductHook) {
        return -1;

4If you are using PrestaShop V1.7.5.0 or above, then make following change for adding sample less than minimal quantity:
Replace the code in `processChangeProductInCart()` in `/controllers/front/CartController.php`

if ($qty_to_check < $product->minimal_quantity) {
    $this->errors[] = $this->trans(
        'The minimum purchase order quantity for the product %product% is %quantity%.',
        array('%product%' => $product->name, '%quantity%' => $product->minimal_quantity),

With –

if ($qty_to_check < $product->minimal_quantity) {
    $sampleProductHook = Hook::exec('actionSampleProductAddInCart', array('idProduct' => $product->id));
    if (!$sampleProductHook) {
        $this->errors[] = $this->trans(
            'The minimum purchase order quantity for the product %product% is %quantity%.',
            array('%product%' => $product->name, '%quantity%' => $product->minimal_quantity),

Configuring the module

In order to allow the purchase of sample products at the shop, firstly you need to configure the module. So, let’s see what options we have in the configuration settings.

In the basic configuration part, you can-

  • Set a maximum number of sample products a customer can order in a single cart.
  • Choose to update stock on the order of the sample product.
  • Allow only logged-in users to order sample products.
  • Show or hide the quantity selector box for the sample product.
  • Customize the background and the text color of the ‘buy sample’ button.

For guest users

As per the configuration, guest users can not buy samples of the product.


Apart from this, there is also a configuration setting for the global sample. Here, global sample simply refers to sample product for every product of the store. If you enable the global sample option from the module configuration, then samples for each & every product will be available for customers.

Global sample

By enabling the global sample the admin can offer the sample product on all the products and the same configurations will apply to all the sample products.

  • Global sample: Enable/Disable the global sample settings.
  • Maximum quantity of each sample product in one cart: The maximum quantity of samples that a customer can buy in one cart.
  • Price type: Set the price type i.e. how a customer will be charged for a sample product.
  • Sample weight: Set the weight of the sample products.
  • Sample button title: Enter the text to show on the ‘buy sample’ button & description of the sample product.
  • Sample description: Enter the description to display on all the sample products.
  • Sample carriers: Select the carriers you want to allow on the sample products.

Note: The setting for the “Global sample” will work on all the products. However, if you have set any other setting for the product individually, then the global setting will not work for this product. Other products will still follow global settings.

Bulk assign

With the help of the bulk assign feature, the admin can assign the sample products in bulk. After clicking on bulk assign, you can see the page is divided into three columns:

  1. Product search filter column
  2. Select product column
  3. Sample setting form column

Product search filter column

In this column, the admin can search the product by entering the name of the products, selecting the category, and selecting the brand and suppliers.

Select products column

In this section, the admin can see the products based on the search action performed by him and select the products on which he wants to offer the sample products.

Sample settings form

After selecting the products the admin needs to enter all the required details available in the sample setting form and after clicking on the save button the sample products will be available on all the selected products.

Note: If the “Global sample” is enabled and the admin assigns the sample product in bulk then the global settings will be overridden by the bulk assign feature for the selected products.

The workflow of the module

Admin can now associate the Sample products with their Standard products. Steps to offer Sample products of a particular standard product. Go to Catalog -> Products -> Edit Product -> Modules.


On clicking the “Configure” button, the admin needs to enable the offer sample option to offer the sample product for that particular product.


After enabling the “Offer sample” option the admin needs to choose the sample settings that he wants to apply to offer the sample for that particular product.


If the admin has chosen the “Global settings” then the sample products will be offered as per the “Global sample” settings configured by the admin.

However, if the admin chooses the “Particular settings” then the admin can enter the required details available in the sample setting forms to offer the sample for that particular product.


Price types

This module has 5 different ways to display a price of a standard product

A) Product standard price

B) Deduct fix amount from product price

C) Deduct percentage of price from product price

D) Custom price

E) Free sample


Price type is set to “Product standard price”, the front end will display as:


In the Front end it will display as:


When price type is set to “Deduct fix amount from product price”


In the Front end it will display as:


When price type is set to “Deduct percentage of price from product price”


In the front end it will display as:


When a price type is set to “Custom price”


In the front end it will display as:


When a price type is set to “Free sample


In the Front end it will display as:


Now, the customer buys the sample of the BROWN BEAR NOTEBOOK. The admin has set the price type of a sample to Deduct fix amount from product price.


Note-: The customer cannot add the standard product and its sample to the cart at the same time. He/she can buy only one at a time.

Cart popup


Cart page


Once the customer purchases the sample, the admin can view the details under the “Orders” tab in the back office.


Order detail page


Note-: As configured by the admin you can add samples of 2 different products only to the cart. The sample of any 3rd product will not be added to the cart.

Buy a sample of any combination of the product

The customers can buy samples of any combination of the product. In order to do so, a customer just needs to select the combination & then click on the “Buy Sample” button.


As you can see, the cart contains samples of two different combinations of the same product.


In this way, a customer can now order samples for any combination of the product.

Add sample product from Quick view

The customers can also buy the sample products from the quick view. The customer just needs to click on the quick view button.


After clicking on the quick view button a popup will appear on the screen from where the customer can buy the sample product.


The process to buy a sample of virtual product

Virtual product:- Process to buy a sample of the virtual product is explained in the screenshots given below.

Admin needs to attach the associated file for the main product then only he/she will be able to attach a sample file to the product. In case if admin attached the main file & forgot to attach the sample file then the customer will not be able to download the sample file if he/she placed an order for a sample product.


Admin can add(if he/she wants to) another file for a sample for preview.


In case, the customer wants to buy a sample of a virtual product, he/she will need to repeat the same process for buying a sample.


Virtual product in the cart


Virtual product on the order confirmation page


Admin can easily check at his back-end whether placed order was for the main product or for sample. A block will notify about the order of the sample products as depicted in the picture below.


After the admin accepts the payment, a customer can download the sample file of the virtual product. Customers can download the file from the order details page.


Note: “If a sample file is attached to a virtual product, then only this file will be provided as a sample for all combinations of this virtual product. Also, you cannot attach a global sample file for all the virtual products of the store.”

This was all about PrestaShop Sample Product Module. I hope this document will help you in checking the functionality of the module in a better way. Also, do let us know about your views in the comments.


For any kind of technical assistance or query, please raise a ticket 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 - 5.3.2

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

. . .

Leave a Comment

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

Be the first to comment.

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