---
updatedAt: 2025-11-13T14:37:36.000Z
agentTools:
  siteIndex: https://docs.affirm.com/llms.txt
  projectIndex: https://docs.affirm.com/developers/v1.0-Global-Integration/llms.txt
---

# Hide Affirm for Certain SKUs (Shopify Plus only)

> ❗️ Retirement of checkout.liquid
>
> As of August 2024, Shopify retires the *checkout.liquid* file for customizing payment methods.\
> Instead, you can use the **Affirm pay-over-time messaging** Shopify app to control the appearance of the Affirm payment option at checkout for your Shopify store. For details, see [Manage Affirm payment customizations for Shopify stores](https://docs.affirm.com/platforms/docs/manage-affirm-payment-customizations-for-shopify-stores).

## Overview

Merchants using Shopify Plus can hide Affirm as a payment option when the customer's cart contains items with certain SKUs.

## Configuration

1\.  Go to the [Shopify script editor](https://help.shopify.com/manual/apps/apps-by-shopify/script-editor)\
2\.  Click **Create Script**\
3\.  Choose **Payment Gateway** for the script type\
4\.  Choose **Blank Template**\
5\.  Click **Create Script**\
6\.  In the **Title box**, enter **Affirm Hide Based on SKU** as the script name\
7\.  Click **Code** to open the Ruby source code console\
8\.  Paste the following code into the console. Replace `SKU-1234` with your SKUs and add as many as you need (this is a comma separated list).

```ruby
available_gateways = Input.payment_gateways
cart = Input.cart
 
SKUS_TO_HIDE = ["SKU-1234", "..."]
 
cart.line_items.each do |item|
  item.variant.skus.each do |sku|
    if SKUS_TO_HIDE.include? sku
      available_gateways = available_gateways.delete_if do |payment_gateway|
        payment_gateway.name == "Affirm - Pay Over Time"
      end
    end
  end
end
Output.payment_gateways = available_gateways
```

9\.  Click **Run Script**\
10..  Click **Save and Publish**

## Tags

Add a [tag](https://help.shopify.com/en/manual/productivity-tools/using-tags) to all the products that you want to hide Affirm as a payment method, Ex: hide-affirm. To hide Affirm as a payment option when the customer's cart contains items with certain product tags:

1\.  Go to the <Anchor title="https://help.shopify.com/manual/apps/apps-by-shopify/script-editor" href="https://help.shopify.com/manual/apps/apps-by-shopify/script-editor">Shopify script editor</Anchor>\
2\.  Click **Create Script**\
3\.  Choose **Payment Gateway** for the script type\
4\.  Choose **Blank Template**\
5\.  Click **Create Script**\
6\.  In the **Title box**, enter **Affirm Hide Based on SKU** as the script name\
7\.  Click Code to open the Ruby source code console\
8\.  Paste the following code into the console and replace `hide-affirm` with the tag you created for the products you want to hide Affirm. You can add as many as you need (this is a comma-separated list).

```ruby
available_gateways = Input.payment_gateways
cart = Input.cart
  
SKUS_TO_HIDE = ["hide-affirm", "..."]
  
cart.line_items.each do |item|
  item.variant.product.tags.each do |tag|
    if SKUS_TO_HIDE.include? tag
      available_gateways = available_gateways.delete_if do |payment_gateway|
        payment_gateway.name == "Affirm - Pay Over Time"
     end
    end
  end
end
Output.payment_gateways = available_gateways
```

9\.  Click **Run Script**\
10..  Click **Save and Publish**

# Sibling pages

* [Using the Promotional Messaging App for Shopify](https://docs.affirm.com/developers/v1.0-Global-Integration/docs/using-the-promotional-messaging-app-for-shopify-ca.md)
* [Setting up Messaging](https://docs.affirm.com/developers/v1.0-Global-Integration/docs/setting-up-messaging-ca.md)
* [Connecting the Affirm Payments App](https://docs.affirm.com/developers/v1.0-Global-Integration/docs/connecting-the-affirm-payments-app-ca.md)
* [Processing Transactions in Shopify](https://docs.affirm.com/developers/v1.0-Global-Integration/docs/processing-transactions-in-shopify-ca.md)
* [Set a Price Floor for Checkout (Shopify Plus only)](https://docs.affirm.com/developers/v1.0-Global-Integration/docs/set-a-price-floor-for-checkout-shopify-plus-only-ca.md)
* [Customize Affirm Promotional Messaging in Shopify](https://docs.affirm.com/developers/v1.0-Global-Integration/docs/customize-affirm-promotional-messaging-in-shopify-ca-en.md)