{% comment %} Renders a product card Accepts: - card_product: {Object} Product Liquid object (optional) - media_aspect_ratio: {String} Size of the product image card. Values are "square" and "portrait". Default is "square" (optional) - image_shape: {String} Image mask to apply to the product image card. Values are "arch", "blob", "chevronleft", "chevronright", "diamond", "parallelogram", and "round". (optional) - show_secondary_image: {Boolean} Show the secondary image on hover. Default: false (optional) - show_vendor: {Boolean} Show the product vendor. Default: false - show_rating: {Boolean} Show the product rating. Default: false - extend_height: {Boolean} Card height extends to available container space. Default: true (optional) - lazy_load: {Boolean} Image should be lazy loaded. Default: true (optional) - show_quick_add: {Boolean} Show the quick add button. - section_id: {String} The ID of the section that contains this card. - horizontal_class: {Boolean} Add a card--horizontal class if set to true. Default: false (optional) - horizontal_quick_add: {Boolean} Changes the quick add button styles when set to true. Default: false (optional) - placeholder_image: {String} The placeholder image to use when no product exists. Default: 'product-apparel-2' (optional) Usage: {% render 'card-product', show_vendor: section.settings.show_vendor %} {% endcomment %} {{ 'component-rating.css' | asset_url | stylesheet_tag }} {{ 'component-volume-pricing.css' | asset_url | stylesheet_tag }} {%- if card_product and card_product != empty -%} {%- liquid assign ratio = 1 if card_product.featured_media and media_aspect_ratio == 'portrait' assign ratio = 0.8 elsif card_product.featured_media and media_aspect_ratio == 'adapt' assign ratio = card_product.featured_media.aspect_ratio endif if ratio == 0 or ratio == null assign ratio = 1 endif -%} {%- else -%} {%- liquid assign ratio = 1 if media_aspect_ratio == 'portrait' assign ratio = 0.8 endif -%} {%- endif -%}