Dr Free Gift & BOGO

Can I strike out the original price of my free gift on cart? (Dr Free Gift, BOGO Buy X Get Y Shopify App)

APP SETUP

Yes, you can display struck-through original prices next to free gifts in your cart. While this feature isn’t controlled directly through our Dr Free Gift, BOGO Buy X Get Y gift management app, you can implement it through your theme’s customization options. The ability to show these crossed-out prices depends on your theme’s capabilities and settings.

Understanding Price Display in Your Cart

When a free gift is added to a cart, it maintains two important price properties:

  • The regular price (set to $0 for gifts)
  • The compare_at price (the original product price)

Your theme determines how these prices are displayed in the cart. Some themes include built-in options to show crossed-out compare_at prices, while others may require custom code implementation.

Implementing Price Strikethrough

If your theme doesn’t automatically display crossed-out original prices, you can add this functionality by customizing your cart template. Here’s how to implement the price strikethrough:

  1. Add the following code to your cart template where prices are displayed (liquid):

{% if item.product.compare_at_price > item.product.price %}

<span class=”crossed-compare-price”>{{ item.product.compare_at_price_max | money_without_trailing_zeros }}</span>

{% endif %}

  1. Add the corresponding CSS to your theme’s stylesheet:

.crossed-compare-price {

    text-decoration: line-through;

}

This code will:

  • Check if a product has a compare_at price higher than its current price
  • Display the compare_at price with a strikethrough effect
  • Format the price without trailing zeros for cleaner presentation

How It Works

The implementation uses Shopify’s liquid templating to:

  1. Compare the original price (compare_at_price) with the current price
  2. Display the original price only when it’s higher than the current price
  3. Apply a strikethrough style using CSS

For free gifts, since their current price is $0, the compare_at price will always be higher, ensuring the original price appears struck through.

Conclusion

Displaying struck-through original prices for free gifts can help emphasize the value of your promotions to customers. Whether you use your theme’s built-in options or implement custom code, ensure the price display enhances rather than complicates the customer experience.

Remember to test thoroughly after implementation and consider how the price display affects your overall cart presentation. A well-implemented price strikethrough can significantly impact how customers perceive the value of your gift promotions.