Checkout page or popup
buy_now, checkout_button, data-ps="buy" and PapelShip.checkout() take a mode:
add_to_cart always adds to the cart and opens the cart drawer.
Liquid themes and code sections
App blocks need no script. Pass the product’sid (or hash_id) as product_id:
product works as an alias of product_id, and a product object is accepted too. product_id wins when both are given.Uploaded designs (and any markup)
From JavaScript
window.PapelShip may load after your script. This helper works in every theme kind:
Where window.PapelShip is available
Inline
<script> tags do not run on Liquid theme pages. Put scripts in assets/*.js and load them with {{ 'x.js' | asset_url | script_tag }}.
Testing
The builder canvas selects elements when you click them, so buttons do nothing there. Turn on Interact in the builder top bar (pressI, or hold Alt), or open the preview.
See App blocks for every block, its arguments and where it works.