Skip to main content
All CollectionsReorder & Reactivate Landing PagesAdditional Settings
Removing items from the Reorder Landing Page cart
Removing items from the Reorder Landing Page cart

This article will demonstrate methods for removing items from the Reorder LP cart

Jason Khan avatar
Written by Jason Khan
Updated over 9 months ago

What are Reorder Landing Pages?

How do I create a Reorder Landing Page?

The Reorder Landing Page offers a convenient way for customers to quickly checkout with the same items they previously purchased. The cart will automatically populate with all the items from their prior order.

In certain situations you may wish to prevent certain items from reappearing in the Reorder Landing Page cart. To do so, please follow the steps shown below.

Step 1: Locate the correct file to edit

From your Shopify Admin access your theme files, specifically the theme.liquid file. Alternatively, if you have a specific Rebuy file in your theme files that is running Rebuy code, you can choose that file instead.

Theme.liquid

Locate the closing body tag, it will look like this </body> you can use cmd + f or control + f to open a search box to help you find the closing body tag.

Note: It's possible to have more than one closing body tag, in such cases you'll want to use the last one, that will be the main body tag for the whole page.


Rebuy theme file

Use the theme files search bar to locate any Rebuy files that may exist within your theme.


Step 2: Add code to remove items from the Reorder LP Cart

First you'll need to decide what items you want to remove.

  • Remove all products

    • The Reorder LP Cart will be empty

  • Remove $0 products

    • If their original order contained any free gifts you don't want them to have again

  • Remove products with certain tags

    • Perhaps their original order contained a promotional or seasonal product

Remove all products from the Reorder LP Cart

To remove all products from the Reorder LP Cart, you can add this code to either your Theme.liquid file or the Rebuy file in your theme files (see step 1 above).

/* clear Reorder Landing Page Cart */
<script>
document.addEventListener('rebuy:reorderLandingPage.ready', function(){
if(Rebuy.ReorderLandingPage){
console.log('clearing cart')
Rebuy.Cart.clearCart()
}
});
</script>

Remove $0 products from the Reorder LP Cart

To remove $0 products from the Reorder LP Cart, you can add this code to either your Theme.liquid file or the Rebuy file in your theme files (see step 1 above).

/* clear $0 products from Reorder Landing Page Cart */
<script>
document.addEventListener('rebuy:reorderLandingPage.ready', function(){
if(Rebuy.ReorderLandingPage){
Rebuy.Cart.cart.items.forEach(item => {
if (item.final_price === 0) {
Rebuy.Cart.removeItem(item)
}
})
}
});
</script>

Remove products with certain tags from the Reorder LP Cart

To remove tagged products from the Reorder LP Cart, you can add this code to either your Theme.liquid file or the Rebuy file in your theme files (see step 1 above).

/* clear tagged products from Reorder Landing Page Cart */
<script>
document.addEventListener('rebuy:reorderLandingPage.ready', function(){
if(Rebuy.ReorderLandingPage){
Rebuy.Cart.cart.items.forEach(item => {
if (item.product.tags.includes('add tag here')) {
Rebuy.Cart.removeItem(item)
}
})
}
});
</script>

You'll need to ensure your products are tagged in Shopify, then edit this code to include that same tag.

Example: If your product is tagged 'seasonal' in Shopify, you'd edit the code above from this.

item.product.tags.includes('add tag here')

To this, ensuring you keep the tag within the quotations.

item.product.tags.includes('seasonal')

Customizations

In certain scenarios it might be useful to both remove $0 products and products with tags. This code can be edited to achieve this in different ways but we've included one easy example of this for you below.

/* clear $0 and tagged products from Reorder Landing Page Cart */
<script>
document.addEventListener('rebuy:reorderLandingPage.ready', function(){
if(Rebuy.ReorderLandingPage){
Rebuy.Cart.cart.items.forEach(item => {
if (item.final_price === 0 || item.product.tags.includes('add tag here')) {
Rebuy.Cart.removeItem(item)
}
})
}
});
</script>

This code will check if the item is $0 or if it has the correct tag and remove the item if either is true.

You'll still need to add the correct tag as shown above in the "Remove products with certain tags from the Reorder LP Cart" option.

If you have multiple products with different tags that may need removing from the Reorder Landing Page Cart, simply add a new common tag to those items.

Example: if you tag those products 'reorderLP" and update the code above to track that tag, then any of those items will be removed should they ever appear in the Reorder Landing Page Cart.

item.product.tags.includes('reorderLP')

Did this answer your question?