Hi all,
I’m trying to use a pre-order date metafield to automatically update our product pages. I have the bones of the code (pasted below) working and displaying messages based on the date compared to the metadata.
I’d like to have this also affect our add-to-cart button, changing it’s colour value and text, but I haven’t worked out how to interact with the button element from the page template. Does anyone know how to call and alter the button’s elements?
{% assign today_date = 'now' | date: '%s' %}
{% assign pre_date = product.metafields.custom.preorder | date: '%s | times: 1' %}
{% if today_date < pre_date %}<b>
Available {{product.metafields.custom.preorder}}.
Please note that any orders including this product will ship once it becomes available.
</b>
{% comment %}
CHANGE THE ADD-TO-CART BUTTON COLOUR, BACKGROUND, FRAME, TEXT ETC. HERE
{% endcomment %}
{% endif %}