I would like to combine two example scripts that are provided by Shopify:
(https://help.shopify.com/en/manual/checkout-settings/script-editor/examples/line-item-scripts#t