{% 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 -%} {%- form 'product', product, id: product_form_id, class: 'form', novalidate: 'novalidate', data-type: 'add-to-cart-form' -%} {%- 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 show_dynamic_checkout -%} {{ form | payment_button }} {%- endif -%}
{%- endform -%}
{%- 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 -%} 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 }}" > {%- endif -%}