Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
We are in the process of converting from checkout.liquid to checkout extensibility. We have two scripts we need to convert. The first displays payment gateways depending on the currency. The second displays shipping options based on currency and shipping address.
I'm just trying to get a jumpstart on all this. If anyone has examples of what they've done and you're willing to share, we'd really appreciate it.
Here are the two scripts:
Payment Gateway display:
currency = Input.cart.presentment_currency customer = Input.cart.customer is_staff_customer = false is_pr_customer = false if customer if customer.tags.include?('staff_offline_payment') is_staff_customer = true end if customer.tags.include?('cust_pricing_group:PR Group') || customer.tags.include?('cust_pricing_group:Lotus Dots PR') is_pr_customer = true end end if currency == "CAD" Output.payment_gateways = Input.payment_gateways.delete_if do |payment_gateway| payment_gateway.name != "OpenPath Payments" || payment_gateway.name == "Shopify Payments" || payment_gateway.name == "OrderTransfer" || payment_gateway.name == "Shop Pay Installments" || payment_gateway.name == "Afterpay" || payment_gateway.name == "PayPal Express Checkout" || (payment_gateway.name == "KicKee Staff" && !is_staff_customer) || (payment_gateway.name == "PR Group" && !is_pr_customer) end end if currency == "USD" Output.payment_gateways = Input.payment_gateways.delete_if do |payment_gateway| payment_gateway.name == "OpenPath Payments" || payment_gateway.name == "OrderTransfer" || payment_gateway.name == "Invoice Me" || (payment_gateway.name == "KicKee Staff" && !is_staff_customer) || (payment_gateway.name == "PR Group" && !is_pr_customer) end end
Shipping rates Display:
currency = Input.cart.presentment_currency.upcase customer = Input.cart.customer can_willcall = false hide_Flat = false province_codes = ["AK", "AS", "FM", "GU", "HI", "MH", "MP", "PW", "PR", "VI", "AA", "AE", "AP"] address = Input.cart.shipping_address location = Input.locale.to_s.downcase isCanada=false if location.include?('ca') isCanada=true end if customer if customer.tags.include?('staff_offline_payment') || customer.tags.include?('cust_pricing_group:PR Group') || customer.tags.include?('cust_pricing_group:Lotus Dots PR') can_willcall = true end end if address.country_code!=nil && address.country_code.upcase=="US" && (province_codes.include?address.province_code.upcase) hide_Flat = true end if address.country_code!=nil && address.country_code.upcase=="CA" && currency=="USD" hide_Flat = true end Output.shipping_rates = Input.shipping_rates.delete_if do |shipping_rate| (shipping_rate.name.upcase!="FLAT RATE" && currency == "CAD" && isCanada) || (shipping_rate.name.upcase=="FLAT RATE" && currency != "CAD") || (shipping_rate.name.upcase=="FLAT RATE" && !isCanada) || (shipping_rate.name.upcase=="WILLCALL" && !can_willcall) || (shipping_rate.name.upcase=="WAREHOUSE PICKUP" && !can_willcall)|| (shipping_rate.name.upcase=="$5.00 FLAT RATE (CONTINENTAL UNITED STATES ONLY)" && (hide_Flat || currency=="CAD")) end
Schmidtc63 did you find a solution here? Confirmed that we are looking to do the same for an AfterPay script ("We have two scripts we need to convert. The first displays payment gateways depending on the currency")
Not yet...hopefully, soon.
We used www.checkoutblocks.com to facilitate our desired UX here. Confirmed that I have spoken with Gil from checkoutblocks.com a few times now, and that I think real highly of him and the service.
If you wind up signing up and checkoutblocks.com solves your problem, let Gil know that Cooper from Form Factory sent you his way 😉
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024