[英]How do I calculate shipping in Simplecart based on total quantity?
My client requires shipping rates based on quantity of items in the order.我的客户根据订单中的商品数量要求运费。
1-10 books - $4 11-24 - $5.50 25-49 - $7 50-99- $8.50 100-199 - $11 200-299 - $16 300-399 - $23 400-499 - $30 1-10 本书 - $4 11-24 - $5.50 25-49 - $7 50-99- $8.50 100-199 - $11 200-299 - $16 300-399 - $23 400-499 - $30
I've been trying to tweak the JavaScript a week now.我一周以来一直在尝试调整 JavaScript。 Anybody know Simplecart well enough to send me in the right direction?任何人都足够了解 Simplecart,可以将我送到正确的方向吗?
You should not have to change the core files.您不必更改核心文件。
See http://simplecartjs.org/documentation/shipping见http://simplecartjs.org/documentation/shipping
simpleCart.shipping(function(){
if( simpleCart.quantity() <= 10 ){
return 4;
}
else if( simpleCart.quantity() < 25 ){
return 5.5;
}
else if( simpleCart.quantity() < 50 ){
return 7.5;
}
else if( simpleCart.quantity() < 100 ){
return 8.5;
}
else if( simpleCart.quantity() < 200 ){
return 11;
}
else if( simpleCart.quantity() < 300 ){
return 16;
}
else if( simpleCart.quantity() < 400 ){
return 23;
}
else if( simpleCart.quantity() < 500 ){
return 30;
}
else {
return 30; // amount for > 500
}
});
simpleCart({
shippingCustom: function () {
if (simpleCart.quantity() > 50) {
return 0;
} else if (simpleCart.quantity() > 20) {
return 10;
} else {
return 20;
}
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.