This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
$(function() { | |
fetch("/geocoder/ip", { | |
method: "get" | |
}).then(function (response) { | |
if (response.ok) { | |
return response.json().then(function(json) { | |
var country_code = json["country_code"]; | |
switch(country_code) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
$(document).ready(function() { | |
// Get the variant_id from the parameter | |
const queryString = window.location.search; | |
const urlParams = new URLSearchParams(queryString); | |
if (urlParams.has('variant_id')) { | |
const variant_id = urlParams.get('variant_id') | |
console.log('-------> '+variant_id) | |
var update_function = function(data) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const coupon = "ABCDEFG" | |
var coupons = function(){ | |
i("#payments_options input:checked").val() == 362229 ? Jumpseller.addCouponToCart(coupon , {callback: alert("Cupon Agregado")}) : Jumpseller.removeCouponFromCart(coupon, {callback: alert("No hay cupon")}) ; | |
} | |
$("#checkout").submit(coupons); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cleanEstimates() { | |
// remove all prices and errors | |
$('#shipping_options li').each(function() { | |
$(this).children().last().detach(); | |
}); | |
// add empty messages - placeholders | |
$('#shipping_options li').each(function() { | |
$(this).append('<span></span>') | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let products = [7966034,7966035]; // Add products IDs here | |
// This may take a while, so it's better to create a loader | |
var setLoading = function(par){if(par){console.log("Inicio")}else{console.log("Inicio")}} | |
setLoading(true); | |
const addListToCart = (index, quantity) => { | |
if(index < products.length){ | |
product = products[index]; | |
Jumpseller.addProductToCart(product, quantity, {}, {callback: addListToCart(++index,quantity)}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
// Define all codes from many promotions | |
const coupons = ["cupon1", "cupon2", "cupon3"] | |
//Callback that returns all coupons in cart | |
var callback_added = function(data) { | |
console.log(data.coupons) | |
} | |
// Callback that searches intersections between the codes in cart and the promotional codes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
const shipping_method_id = 1234556 // id of free shipping option | |
const normal_shipping = 654321 // id of normal shipping option | |
const municipalities_free_shipping = ["merchant needs to complete this field"] // Ideally a theme option separated by comma | |
const products_free_shipping = ["merchant needs to complete this field"] // Ideally a theme option separated by comma | |
var conditions = function() { | |
// certain product is in the cart and certain municipalities are selected. The work is to construct this function | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var callbackFunction = function() { | |
console.log("Coupon " + discount + " added") | |
} | |
var add_url_coupon = function() { | |
queryString = window.location.search; | |
urlParams = new URLSearchParams(queryString); | |
if (urlParams.has('discount')) { | |
discount = urlParams.get('discount') | |
Jumpseller.addCouponToCart(discount, { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
// Get the variant_id from the parameter | |
const queryString = window.location.search; | |
const urlParams = new URLSearchParams(queryString); | |
if (urlParams.has('variant_id')) { | |
const variant_id = urlParams.get('variant_id') | |
var update_function = function(data) { | |
// Find the variant | |
active_variant = data.variants.find(item => item.id == variant_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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) { |
NewerOlder