Choose payment method later

Topic summary

A Shopify Plus merchant is trying to remove the “Choose payment method later” (Deferred payment) option from their B2B/wholesale checkout but their payment customization app isn’t working as expected.

The Issue:

  • The merchant built a payment customization function but it’s not successfully hiding the deferred payment option
  • They shared their JavaScript code, which appears to have formatting/encoding issues making it difficult to read

The Solution Provided:

  • Another user identified the problem: the configuration.paymentMethodName needs to return the exact value "Deferred"
  • This allows the code to properly find and hide the “Choose payment method later” option via the input.paymentMethods.find() method

Current Status:

  • The discussion appears to have reached a resolution with specific technical guidance provided
  • Implementation by the original poster is pending
Summarized with AI on November 11. AI used: claude-sonnet-4-5-20250929.

Hello everyone, new here. Hoping someone can help with this issue I’m having. I want to remove the option for customers to choose payment method later. I have tried building payment customization and adding the app to the store but that doesn’t do it. My store URL is https://wholesale-blindbarber.myshopify.com/pages/line-sheet

Any help would be appreciated!

// -check

/**
* @typedef {import("../generated/api").RunInput} RunInput
* @typedef {import("../generated/api").FunctionRunResult} FunctionRunResult
*/

/**
*  {FunctionRunResult}
*/
const NO_CHANGES = {
  operations: [],
};

/**
*  {RunInput} input
* @returns {FunctionRunResult}
*/
export function run(input) {
  // Define a type for your configuration, and parse it from the metafield
  /**
  *  {{
  *   paymentMethodName: string
  *   cartTotal: number
  * }}
  */
  const configuration = JSON.parse(
    input?.paymentCustomization?.metafield?.value ?? "{}"
  );
  if (!configuration.paymentMethodName || !configuration.cartTotal) {
    return NO_CHANGES;
  }

  const cartTotal = parseFloat(input.cart.cost.totalAmount.amount ?? "0.1");
  // Use the configured cart total instead of a hardcoded value
  if (cartTotal < configuration.cartTotal) {
    console.error("Hiding payment method");
    return NO_CHANGES;
  }

  // Use the configured payment method name instead of a hardcoded value
  const hidePaymentMethod = input.paymentMethods
    .find(method => method.name.includes(configuration.paymentMethodName));

  if (!hidePaymentMethod) {
    return NO_CHANGES;
  }

  return {
    operations: [{
      hide: {
        paymentMethodId: hidePaymentMethod.id
      }
    }]
  };
};

1 Like

Hi there! You need to make sure that configuration.paymentMethodName returns Deferred in

const hidePaymentMethod = input.paymentMethods.find(method => method.name.includes(configuration.paymentMethodName));

so that it can find Choose payment method later. Hope that helps!