Skip to content

Instantly share code, notes, and snippets.

<script>
// Variables
var productId = 7576049 // Create virtual product and get the product id
var variant1 = 11996397 // Create a variant of the product, this is the variant that will go to the cart.
// Conditions Function: This function returns true or false depending if the conditions are present or not on the checkout. This part can change depending on the conditions.
var conditions = function(){
return $("#ID_DE_CAJA_DE_VERIFICACION").is(":checked"); // Certain payment option is selected on this example
}
// Finds product_cart_id by searching the productId on the cart. The Product Cart Id is the ID of the instance of the product that is on the cart. This section shouldn't change.
function find_order_product_id(cart_json) {
<!-- creates a custom select on the Contact page -->
<div id="custom_select_container" class="field col-md-12">
<label for="contactpage_name" class="required control-label">Custom Field <em>*</em></label><br>
<select id="custom_select" class="text form-control" required="required" >
<option value=""></option>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
</select>
</div>
<!-- Instructions
Step 1: identify Payment Method IDs:
- Avalpay: 251942
- Bancolombia: 251947
- Contra entrega: 271580
Step 2: Upload logos to the code editor
Step 3: Paste the code on the checkout.
->>
<script>
<script>
var Fn = {
validaRut: function(rutCompleto) {
if (!/^[0-9]+-[0-9kK]{1}$/.test(rutCompleto))
return false;
var tmp = rutCompleto.split('-');
var digv = tmp[1];
var rut = tmp[0];
if (digv == 'K') digv = 'k';
return (Fn.dv(rut) == digv);
<script type="application/javascript">
var dte_fields = function() {
if ($("#order_other_boleta_o_factura").val().includes("Boleta")) {
$("#other_giro,#other_razon_social").hide();
$("#other_giro,#other_razon_social").removeAttr("required");
} else {
$("#other_giro,#other_razon_social").show();
$("#other_giro,#other_razon_social").attr("required", "required");
}
}
<script>
$(document).ready(function(){
addRutValidator($('#order_shipping_address_taxid'));
addRutValidatorForBillingAddress($('#order_billing_address_taxid'));
$("#shipping_same_as_billing").on('change', function(evt) {
addRutValidatorForBillingAddress($('#order_billing_address_taxid'));
})
})
function addRutValidatorForBillingAddress(element) {
<script type="application/javascript">
$(document).ready(function(){
$("#order_customer_phone").attr("pattern","/^(\+?56)?(\s?)(0?9)(\s?)[9876543]\d{7}$/");
$("#order_customer_phone").attr("placeholder","+569XXXXXXXX");
});
</script>
<script type="application/javascript">
$(document).ready(function(){
$("#order_shipping_address_city").val("Content");
$("#shipping_address_city").hide();});
</script>
<script type="application/javascript">
$(document).ready(function(){
$("#shipping_address_postal").hide();
});
</script>
<!-- START - Create an Array with the selected filters -->
{% capture selected_values %}
{% for filter in filters %}
{% for value in filter.values %}
{% if value.selected %}
{{value.name }}
{% endif %}
{% endfor %}
{% endfor %}
{% endcapture %}