Note: This article is for internal use only. In our latest Wholesale All In One app version, we have auto-integration with the 'Store Pickup + Delivery by Zapiet' app, and no coding action is required. However, if you're facing any problems with the wholesale order where pickup options are not working, please contact us. |
Integration steps for extension based old version
Point # 1:= var valid_chk = false; setInterval(function(){ if(window.ZapietCheckoutEnabled && valid_chk == false){ WSAIO.checkoutEventListner(); valid_chk =true; }else if(!window.ZapietCheckoutEnabled && valid_chk == true){ valid_chk =false; } },100) Point # 2:= if (!1 === WSAIO.isWholesaleCustomer() || !1 === window.ZapietCheckoutEnabled) { Point # 3:= if (!1 === WSAIO.isWholesaleCustomer() || !1 === window.ZapietCheckoutEnabled) { Point # 4:= var note_attr = []; for(var [d,b] of Object.entries(f.attributes)){ note_attr.push({ "name": d, "value": b }); } note_attributes:note_attr Point # 5:= if(a.customer.id == null && window.ZapietCheckoutEnabled){ var checkout_params = Zapiet.Widget.getCheckoutParams(); c.checkout_url = c.checkout_url+'/?'+new URLSearchParams(checkout_params); } Point # 6:= <script type="text/javascript"> document.addEventListener("DOMContentLoaded", function(event) { window.customCheckoutValidation = function() { if(typeof WSAIO != "undefined" && typeof WSAIO.getDiscountCode == 'function'){ WSAIO.getDiscountCode(function(b, c) { var discountt = c.checkout_url.split("discount=")[1]; var discount = (discountt === undefined) ? ' ' : discountt; var checkout_params = Zapiet.Widget.getCheckoutParams(); checkout_params.discount = discount; window.location = '/checkout?' + new URLSearchParams(checkout_params); }); }else{ var checkout_params = Zapiet.Widget.getCheckoutParams(); checkout_params.discount = ' ' console.log('/checkout?' + new URLSearchParams(checkout_params)) window.location = '/checkout?' + new URLSearchParams(checkout_params); } }; }); </script>
Add steps based on screenshot https://imagelink.click/mrQSEf.png
Integration steps for old version 2.3.7
Follow instructions to integrate Store Pickup + Delivery by Zapiet app with Wholesale all in one.
Within your themes storepickup-addons.liquid file add the following code:
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function(event) {
window.customCheckoutValidation = function() {
document.getElementById("checkoutBtn").innerHTML = "Loading ...";
_coup('a', function(){
var discount = (window.win_coupanCode === 'undefined') ? ' ' : window.win_coupanCode;
var checkout_params = Zapiet.Widget.getCheckoutParams();
checkout_params.discount = discount;
window.location = '/checkout?' + new URLSearchParams(checkout_params);
});
};
});
</script>
That's it. Now both apps should play well together.
Step #1: You need to add this code in storepickup-addons.liquid file
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function(event) {
window.customCheckoutValidation = function() {
if(typeof WSAIO != "undefined" && typeof WSAIO.getDiscountCode == 'function'){
WSAIO.getDiscountCode(function(b, c) {
var discountt = c.checkout_url.split("discount=")[1];
var discount = (discountt === undefined) ? ' ' : discountt;
var checkout_params = Zapiet.Widget.getCheckoutParams();
checkout_params.discount = discount;
window.location = '/checkout?' + new URLSearchParams(checkout_params);
});
}else{
var checkout_params = Zapiet.Widget.getCheckoutParams();
checkout_params.discount = ' '
window.location = '/checkout?' + new URLSearchParams(checkout_params);
}
};
});
</script>
Step #2: Add this function in wholesale-all-in-one.min.js file under WSAIO.checkout function
WSAIO.getDiscountCode = function(callback) {
if (WSAIO["debugger"]) {
debugger;
}
a.fetchCart(function(b, c) {
if (b) {
return h(b);
}
var note_attr = [];
Object.keys(c.attributes).forEach(function(key, i){
var item = c.attributes[key];
note_attr.push({
"name": key,
"value": item
});
});
}
console.log("note_attr",c.attribute);
a.checkoutRequest({
note_attributes:note_attr,
cart:c,
tags:"wsaio-app",
note:g("[name=note]").val(),
shopInfo:a.shopInfo,
customer:a.customer,
user_mode:a.user_mode,
currency:a.shopInfo.currency,
custom_line_items:[],
shopifyCurrencies:a.getCurrencies(),
discount_code_application:WSAIO.DiscountCode.application,
products_with_collections:a.products_with_collections},
callback);
});
};
Step #3: Find this g(document).on("click", a.checkout_selector, function(b) { in wholesale-all-in-one.min.js file and comment inner code
WSAIO.checkoutEventListner = function(b) {
g(a.checkout_selector).removeAttr("disabled");
g(document).on("click", a.checkout_selector, function(b) {
// b.preventDefault();
// b.stopImmediatePropagation();
// b.stopPropagation();
// g(this).attr("disabled");
// g(this).find('[name="discount"], [name="clear_discount"]').remove();
// g(this).parents("form").find('[name="discount"], [name="clear_discount"]').remove();
// k("Wholesale All In One checkout is working.");
// a.checkout();
});
};
Step #4: Change checkout discount method to 'Coupon Code' from the application settings.
Validation for NET Terms feature
Check that the window.ZapietCheckoutEnabled is `true`? When that parameter is true it means that "Store Pickup + Delivery" validation has been ran and the customer is allowed to proceed to the checkout. If the value is false then they should not be directed to the checkout.
That's it. Now both apps should play well together.
Comments
0 comments
Article is closed for comments.