Vorbly <Code>
CODING MADE EASY WITH VORBLY
WIX CODE CALCULATIONS - MULTIPLY NUMBERS
Need a customized shopping cart? This tutorial will show you how to multiply price and quantity using Wix Code. We will provide you with the webpage elements and sample codes required to implement this feature.
THE DEMO
THE ELEMENTS
The Page
User Input: #quantity
Text Elements:
-
Unit Price: #UnitPrice
-
Total Price: #FinalPrice
THE CODE
Page Code
export function quantity_change(event, $w) {
let price = Number($w('#UnitPrice').text);
let selectedQuantity = Number(event.target.value);
$w('#FinalPrice').text = String(selectedQuantity * price);
}
COMMENTS
I'm a paragraph. Click here to add your own text and edit me. It's easy.