Read More
Read More
Menu Close

    Prestashop Sample Product {User Guide}

    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.

    Check the overview of the plugin in the video mentioned-below –

    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 product.
    • 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 sample product.
    • Allow or restrict only logged-in users to order sample product.
    • Customize the text and the background colour of the ‘buy sample’ button.
    • Now, customers can order sample of any combination of the product.
    • Configure global settings to offer a sample of all the products of the catalog.
    • Enable/disable tax on the purchase of a sample product.
    • Offer sample version of virtual products too.
    • Upload another file for sample virtual product for preview.
    • The main product can not be added while its sample is already in cart.
    • A new label to notify sample product will show in cart.
    • Buyers can even choose the quantity of sample product.
    • The module is multi-shop compatible.

    How to install Prestashop Sample Product module

    • Firstly, Go to the Module Manager in 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.
    Click to upload Prestashop Subscription Products module
    Drop or select Prestashop Subscription Products module file
    Prestashop Subscription Products module installed on prestashop


    1) To enable selling of sample of virtual products, add a new custom hook in /controllers/front/GetFileController.php for downloading virtual product sample:
    * Just before line:  *$mimeType = false;*

    Add this line

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

    2. If you want to enable “Minimum quantity for sale” for sample products then add a new custom hook in

    Searching for an experienced
    Prestashop Company ?
    Read More

    /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;

    3) If 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 purchase of sample product at the shop, firstly you need to configure the module. So, let’s see what all options do we have in the configuration settings?

    In the basic configuration part, you can-

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

    For guest users

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


    Apart from this, there is a configuration setting for the global sample too. Here, global sample simply refers to sample product for every product of the store. In case, if you enable global sample, then sample for each & every product will be available for customers. And, customers can buy them.

    Additionally, it also contains some extra setting like:

    • The maximum quantity of sample that a customer can buy in a single cart.
    • Price type i.e. how a customer will be charged for sample product.
    • Text to show on ‘buy sample’ button & description of the sample product.

    Note: Please note that 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.

    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 -> Add New Product -> Modules.


    On clicking Configure button, admin can set the configurations of a sample product associated with the standard product.

    Note-: We have 5 different ways to display a price of a standard product A) Product Actual Price B) Deduct fix amount from product price C) A Percentage of product price D) Custom Price E) Free Sample


    Price Type is set to Product Actual Price, the front end will display as:


    In Front end it will display as:


    When Price Type is set to Deduct fix amount from product price


    In Front end it will display as:


    When Price Type is set to A Percentage of 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 Front end it will display as:


    Now, customer buys the sample of 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 same time. He/she can buy only one at a time.

    Cart Popup


    Cart Page


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


    On clicking View Button


    Note-: You can add samples of 2 different products only to the cart. Sample of any 3rd product will not be added as per the configurations set by the admin in the back office.

    Buy a sample of any combination of the product

    Earlier, a buyer can only buy sample of the default combination of the product. Now, they can buy sample of any combination of the product. In order to do so, a customer just needs to select the combination & then click on “Buy Sample” button.


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


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

    Process to buy sample of virtual product

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

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

    virtual 1

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


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

    virtual 3
    virtual 5

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

    virtual 6

    After 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.

    virtual 7

    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.1.0

    Supported Framework Version - 1.7.x.x

    Blog Version - 1.7.x.x
    • Version 1.7.x.x
    • Version 1.6.x.x
    . . .
    Discuss on Helpdesk

    Leave a Comment

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

    Be the first to comment.

    Back to Top

    Table of Content