To continue receiving payouts, you need to secure your account by turning on two-step authentication. If two-step authentication is not turned on your payouts will be paused. Learn more

2 shipping scripts - How can I combine them?

New Member
2 0 0

I have two scripts for the checkout.

How can I combine them? Only one script can be published in the checkout section in the script editor. 


The first script for sorting the shipping solution

desired_order = ["DHL","FedEx","DPD","FedEx Express","DPD Express"]

Output.shipping_rates = Input.shipping_rates.sort_by do |shipping_rate|
desired_order.index( || desired_order.length

and a second script to hide the shipping solution when entering a Packstation in the address field.

shippingaddress1 = Input.cart.shipping_address.address1.upcase.split[0...-1].join ' '
puts shippingaddress1
if checkpobox.include?(shippingaddress1)
  hideship = ['DPD','DPD Express','FedEx','FedEx Express']
  hideship = ['NO DPD']

Output.shipping_rates = Input.shipping_rates.delete_if do |shipping_rate|
  hideship.any? { |hideship| }

Thanks for help

Reply 1 (1)
New Member
2 0 0

Could anyone help?

Is it also possible to include a query that if "checkpobox" has something entered like 'PACKSTATION','POSTFILIALE' , then the field "Optional address2 label" is a required field?


Thanks a lot