For the complete documentation index, see llms.txt. This page is also available as Markdown.

Payment Customization

Hide, rename or reorder payment methods at checkout with JavaScript.

A payment customization changes which payment methods are offered at checkout and how they are presented. Your code inspects the cart and returns a list of operations.

var ops = [];

input.paymentMethods.forEach(function (method) {
  if (method.name === 'Cash on Delivery') {
    ops.push({ paymentMethodHide: { paymentMethodId: method.id } });
  }
});

return { operations: ops };

The available payment methods are in input.paymentMethods, each with an id and name.

Operations

Return an array of operations, or { operations: [...] }. Each operation is an object with exactly one of these keys:

Operation
Shape
Effect

Hide

{ paymentMethodHide: { paymentMethodId: '...' } }

Removes the payment method

Rename

{ paymentMethodRename: { paymentMethodId: '...', name: '...' } }

Changes the displayed name

Move

{ paymentMethodMove: { paymentMethodId: '...', index: 0 } }

Moves the method to a position (0 = first)

Order review

{ orderReviewAdd: { ... } }

B2B on Shopify Plus: submits the checkout as a draft order for merchant review

Payment terms

{ paymentTermsSet: { ... } }

Shopify Plus only: net terms, due dates, deposits

Returning an empty array leaves the payment methods unchanged. Operations of any other shape are ignored.

Examples

Hide Cash on Delivery above an order value (use the General or Cart family):

Put invoice payment first for B2B customers (use a family that selects the customer, e.g. Customer):

Notes

  • Payment customizations don't use the Run on steps — they apply whenever payment methods are shown.

  • If your code throws, no operations are applied and checkout shows the methods unchanged (fail open).

Last updated