Skip to content

Instantly share code, notes, and snippets.

<script>
var payment = "99578"
$(document).ready(function(){
$("#order_payment_method_" + payment).parent().attr('id', 'top');
$("#order_payment_method_" + payment).parent().parent().attr('id', 'payments_ul');
$("#top").prependTo("#payments_ul");
$("#order_payment_method_" + payment).click();
});
</script>
<style>
.pop-up_canvas {
background: #e65f5f;
z-index: 9998;
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
display: none;
// Step 1: Create a virtual Product Called "Envio a Cobranza" with two Variants: Portugal/Spain
// Step 2: Get the Product and variants IDs
// Step 3: replace the following variables with the Product ID (in the product settings URL), Variant Ids (see tip below) and Manual Payment ID (In the payment method URL in the admin panel)
var productId = "2388937"
var portugalId = "1883423"
var spainId = "1883423"
var paymentId = "136033"
/* TIP: To get the variant ID of the countries I added this code to the product page and checked the console
<script>
var paymentId = 105935 // replace the id for the payment ID (last number on payment URL in admin panel, Ex: https://www.evernote.com/l/AJrfSyLBf_FNeo2o4Zhsw4jOUclx150s4OQ ) )
$(document).ready(function(){
$("input[value=" + paymentId + "]").parent().hide()
});
</script>
{%assign min_price = product.price %}
{%assign max_price = product.price %}
{% for variant in product.variants %}
{% if max_price < variant.price %}
{%assign max_price = variant.price %}
{% endif %}
{% if min_price > variant.price %}
<script>
$(document).ready(function(){
$('#other_razon_social, #other_giro').hide();
})
$('#order_other_boleta_o_factura').on('change', function() {
var option = $("#order_other_boleta_o_factura option:selected").val();
if(option == 'Factura Electrónica'){
$('#other_razon_social, #other_giro').show();
// This example will remove all Regions that are not "12" and all Municipalities not listed below.
var shipping_to = ["Cerrillos","Cerro Navia","Conchali","El Bosque","Estacion Central","Huechuraba","Independencia","La Cisterna","La Florida","La Granja","La Pintana","La Reina","Las Condes","Lo Barnechea","Lo Espejo","Lo Prado","Macul","Maipu","Ñuñoa","Padre Hurtado","Pedro Aguierre Cerda","PeÑAlolen","Providencia","Pudahuel","Puente Alto","Quilicura","Quinta Normal","Recoleta","Renca","San Bernardo","San Joaquin","San Miguel","San Ramon","Santiago Centro","Vitacura"]
function removeItems(select,shipping_to){
$('#' + select +' option:not(:first)').filter(function() {
return $.inArray($.trim($(this).text()), shipping_to) == -1;
}).remove();
};
$("#order_shipping_address_region").change(function(){
<script>
$(document).ready(function(){
$('<div class="form-group"><div style="margin-top: 16px;" id="contactpage_custom" class="field"><label for="contactpage_custom" class="control-label">Empresa</label><br><input type="text" name="contact[custom]" id="contact_pcustom" class="text form-control"></div></div>').insertAfter("#contactpage_name")
});
$("#contact_form").submit(function(){
$("#contact_message").val("Empresa: "+ $("#contact_pcustom").val() + "\n" + $("#contact_message").val())
});
</script>
function international(country){
if($("#order_shipping_address_country").val() == country ){
$("input[value='127765']").parent().hide(); // International
$("input[value='43917']").parent().show(); // Chile
$("input[value='43914']").parent().show(); // Chile
$("input[value='43915']").parent().show(); // Chile
$("input[value='43916']").parent().show(); // Chile
$("input[value='43914']").click(); // Chile
}else{
$("input[value='127765']").parent().show(); // International
{% assign FBT = order.products.first.field["Frequently Bought Together"].value | split: "," %}
<div class="row nogutter">
{% for prod in FBT %}
{% assign product = products.product[prod] %}
<div class="col-md-3 col-6">
<div class="main-category-image">
{% include 'list_product' with product %}
</div>
</div>
{% endfor %}