Vorbly <Code>

CODING MADE EASY WITH VORBLY

WIX REPEATER HIDE CONTENT ON LOAD

Need to hide or disable Wix Repeater content based on database? For example, if products are out of stock, hide pricing, show "SOLD OUT" label and disable "ADD TO CART" button. We will provide you with the webpage elements and sample codes required to implement this feature.

THE DEMO

1/1

THE ELEMENTS

The Page

Repeater: #repeater1

  • Product Name: #name

  • Product Description: #description

  • Price: #price

  • Quantity Available: #stock

  • Add To Cart Button: #button1

  • Quantity Input Field & Buttons: #group1

The Database

Create a database: Products (dataset1)

  • Product Name: name

  • Product Description: description

  • Price: price

  • Quantity Available: stock

Then link fields to your repeater.

THE CODE

Page Code

    $w("#dataset1").onReady(() => {

        $w("#repeater1").onItemReady(($w, itemData, index) => {

 

            let stock = $w('#dataset1').getCurrentItem().stock;

 

            if (stock > 0) {

                $w('#button1').enable();

 

            } else {

                $w('#button1').disable();

                $w('#text16').text = "Sold Out";

            }

 

        })

    })

})

COMMENTS

I'm a paragraph. Click here to add your own text and edit me. It's easy.

WEB DESIGN & DEVELOPMENT SOLUTIONS

GET PROFESSIONAL HELP