Redirecting 'sold out' to a contact page via an 'enquire now' button


Hey fam,

I’m on the final edits of a site and I’ve stumped myself a little in trying to make the build as easy for my clients as possible. We’d like to deliberately set a few things up as sold out so the use has to enquire about the item and cannot directly add it to cart.

How does one set up the ‘sold out’ button to say ‘enquire now’ (I’ve got that part down) but then lead users to the contact page?

which theme are you using right now?

We’re using Dawn (on the lastest 12.0 version)

Hi @tmtudisco ,
Can you kindly share your store link (with the password, if any) with us? We will check it and suggest you a solution if possible.

Hi @tmtudisco ,

If you are using Dawn and never modified the buy-buttons.liquid file, please follow below step to add this feature.

NOTE: Do take backup of all the files before editing template files.

Step 1: Edit your active theme

Step 2: Replace content of buy-buttons.liquid with the content from the attached file.

Step 3: Replace the redirect url to the URL of your contact us page

Step 4: Save the changes

Step 5: For product pages where you want to add the “enquire now” button, add “enquire-now” tag.

To remove this feature, just replace the buy-buttons.liquid with the buy-buttons.liquid you backup.

If I managed to help you then, don’t forget to Like it and Mark it as Solution!

Best Regards,

Makka

Hey, you are amazing thank you! I will give this a try tomorrow and let you know how it goes!

Is there a way to for these items - without editing the stock numbers so they have that on the back end - to remove the ‘buy buttons’ or does this solution cancel out the ‘add to cart’ and buy buttons?

Hi @tmtudisco ,

My solution doesnot require stock numbers to add Enquire Now buttons. It will auto add Enquire Now button if the product has a tag “enquire-now”. Have tried updating the file?

If I wanted to remove the capacity to have buy buttons and add to cart’s on some of the items, how would I go about that as well!

Nope note yet, I’m just about to as we speak (was getting all the other tweaks done first).

So I’ve added in the line of code…

Added in the enquire-now and tried enquire_now but we have nothing…

Hi @tmtudisco ,

You will have to replace the whole file. Please replace the code of “buy-buttons.liquid” with below code.

Note: Please do keep backup of your original files.

{% assign enquery_now_url = 'https://mangit.myshopify.com/products/product-2' %}
{% comment %}
  Renders product buy-buttons.
  Accepts:
  - product: {Object} product object.
  - block: {Object} passing the block information.
  - product_form_id: {String} product form id.
  - section_id: {String} id of section to which this snippet belongs.
  - show_pickup_availability: {Boolean} for the pickup availability. If true the pickup availability is rendered, false - not rendered (optional).

  Usage:
  {% render 'buy-buttons', block: block, product: product, product_form_id: product_form_id, section_id: section.id, show_pickup_availability: true %}
{% endcomment %}

  {%- if product != blank -%}
    {%- liquid
      assign gift_card_recipient_feature_active = false
      if block.settings.show_gift_card_recipient and product.gift_card?
        assign gift_card_recipient_feature_active = true
      endif

      assign show_dynamic_checkout = false
      if block.settings.show_dynamic_checkout and gift_card_recipient_feature_active == false
        assign show_dynamic_checkout = true
      endif
    -%}

    
  {%- else -%}
    

      

        
      

    

  {%- endif -%}

  {%- if show_pickup_availability -%}
    {{ 'component-pickup-availability.css' | asset_url | stylesheet_tag }}

    {%- assign pick_up_availabilities = product.selected_or_first_available_variant.store_availabilities
      | where: 'pick_up_enabled', true
    -%}

    

    
  {%- endif -%}

1 Like

Ohhhhh I got you thank you! Putting that in now! is it meant to be ‘enquiry’ instead of enquery in the top line?

Wait, I answered my own question, ignore that!

YAY that worked thank you!!!

Hi @tmtudisco ,

Glad to hear that worked. However, I noticed that you have added “.myshopify.com” url as enquery_now_url . Do update it with your real domain once you get an active domain.

Also, one quick suggestion, the white font color on the pink background doesnot pass the contrast ratio. Try updating it to a darker color[maybe #708090] for better visibility.

recomended

Thank you

Hey,

We haven’t connected the domain yet, but when that happens I shall. Thank you for the reminder though.

1 Like

Thank you for the heads up, it’s been a discussion between I and the client for a while now :sweat_smile:

Hi @theycallmemakka thanks for your work on this. I have followed your steps but I am encountering the problem where the the “Enquire Now” button does not redirect to the contact page.

https://613e29-3.myshopify.com/

This is the code from the buy-buttons.liquid

{% assign enquire_now_url = ‘https://613e29-3.myshopify.com/pages/contact/’ %}
{% comment %}
Renders product buy-buttons.
Accepts:

  • product: {Object} product object.
  • block: {Object} passing the block information.
  • product_form_id: {String} product form id.
  • section_id: {String} id of section to which this snippet belongs.
  • show_pickup_availability: {Boolean} for the pickup availability. If true the pickup availability is rendered, false - not rendered (optional).

Usage:
{% render ‘buy-buttons’, block: block, product: product, product_form_id: product_form_id, section_id: section.id, show_pickup_availability: true %}
{% endcomment %}

{%- if product != blank -%} {%- liquid assign gift_card_recipient_feature_active = false if block.settings.show_gift_card_recipient and product.gift_card? assign gift_card_recipient_feature_active = true endif

assign show_dynamic_checkout = false
if block.settings.show_dynamic_checkout and gift_card_recipient_feature_active == false
assign show_dynamic_checkout = true
endif
-%}

<product-form
class=“product-form”
data-hide-errors=“{{ gift_card_recipient_feature_active }}”
data-section-id=“{{ section.id }}”

{%- form ‘product’,
product,
id: product_form_id,
class: ‘form’,
novalidate: ‘novalidate’,
data-type: ‘add-to-cart-form’
-%}
<input
type=“hidden”
name=“id”
value=“{{ product.selected_or_first_available_variant.id }}”
{% if product.selected_or_first_available_variant.available == false or quantity_rule_soldout %}
disabled
{% endif %}
class=“product-variant-id”

{%- if gift_card_recipient_feature_active -%}
{%- render ‘gift-card-recipient-form’, product: product, form: form, section: section -%}
{%- endif -%}

{%- liquid assign check_against_inventory = true if product.selected_or_first_available_variant.inventory_management != 'shopify' or product.selected_or_first_available_variant.inventory_policy == 'continue' assign check_against_inventory = false endif if product.selected_or_first_available_variant.quantity_rule.min > product.selected_or_first_available_variant.inventory_quantity and check_against_inventory assign quantity_rule_soldout = true endif -%} {% if product.tags contains "enquire-now" %} Enquire Now {% else %} {%- if product.selected_or_first_available_variant.available == false or quantity_rule_soldout -%} {{ 'products.product.sold_out' | t }} {%- else -%} {{ 'products.product.add_to_cart' | t }} {%- endif -%} {%- render 'loading-spinner' -%} {%- if show_dynamic_checkout -%} {{ form | payment_button }} {%- endif -%} {% endif %}
{%- endform -%} {%- else -%}
{{ 'products.product.sold_out' | t }}
{%- endif -%}

{%- if show_pickup_availability -%}
{{ ‘component-pickup-availability.css’ | asset_url | stylesheet_tag }}

{%- assign pick_up_availabilities = product.selected_or_first_available_variant.store_availabilities
| where: ‘pick_up_enabled’, true
-%}

<pickup-availability
class=“product__pickup-availabilities no-js-hidden quick-add-hidden”
{% if product.selected_or_first_available_variant.available and pick_up_availabilities.size > 0 %}
available
{% endif %}
data-root-url=“{{ routes.root_url }}”
data-variant-id=“{{ product.selected_or_first_available_variant.id }}”
data-has-only-default-variant=“{{ product.has_only_default_variant }}”
data-product-page-color-scheme=“gradient color-{{ section.settings.color_scheme }}”

{% render 'icon-unavailable' %}

{{ 'products.product.pickup_availability.unavailable' | t }}

{{ 'products.product.pickup_availability.refresh' | t }}

{%- endif -%}

I would also be grateful if you could guide me on how i can “grab” the product information and “attach” it to the contact form so as it is known which product the customer is enquiring about.

Thanks in advance.

Hi Thanks for the code. I have added it to a shop i am compiling however when I click the “Enquire Now” button it does not direct to the Contact Page.

Would you also have any advice on hoe to Grab the product info and attach it to the contact form so as to know which product they are enquiring about

Thanks.