Theme with render structure

For the render structure themes instead of including WPD files Please use the below code. The below code is just for example. Please copy it from the wcp_render_discount.liquid file it will always contain the latest code (if we add any fix).

// Instead of this code
{% include 'wcp_discount' with product %} 
{%- assign current_variant = product.selected_or_first_available_variant -%}
{% include 'wcp_variant' with current_variant %}

// Use this code
{% capture wpd_discounted_prices %}{%- render 'wcp_discount'  wcp_discount:product , wpd_is_render:'yes' -%}{% endcapture %}
{%- capture wcp_price -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_price' -%}{%- endcapture -%}
{%- capture wcp_compare_at_price  -%}{%- render 'wcp_render_discount', wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_compare_at_price' -%}{%- endcapture -%}
{%- capture wcp_compare_at_price_min  -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_compare_at_price_min' -%}{%- endcapture -%}
{%- capture wcp_compare_at_price_max  -%}{%- render 'wcp_render_discount', wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_compare_at_price_max' -%}{%- endcapture -%}
{%- capture wcp_price_min -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_price_min' -%}{%- endcapture -%}
{%- capture wcp_price_max -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_price_max' -%}{%- endcapture -%}

{%- capture v_discount_tag -%}{%-render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'v_discount_tag'-%}{%- endcapture -%}
{%- capture wcp_discount_value -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_discount_value' -%}{%- endcapture -%}
{%- capture p_discount_tag -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'p_discount_tag' -%}{%- endcapture -%}

{% assign raw_set_prices = product.metafields.wcp_set_prices.wcp_set_prices %}
{% assign set_prices_array = blank %}
{% if raw_set_prices %}
    {% assign set_prices_array = raw_set_prices | split: "," %}
{% endif %}

{% assign v_discount_tag = v_discount_tag | strip %}
{% assign p_discount_tag = p_discount_tag | strip %}
{% capture wcp_v_discounted_prices %}{%- render 'wcp_variant' , wcp_variant:product.selected_or_first_available_variant , set_prices_array:set_prices_array , wpd_is_render:'yes', v_discount_tag : v_discount_tag , wcp_discount_value : wcp_discount_value -%}{%- endcapture -%}
{%- capture wcp_v_price -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wcp_v_discounted_prices, price_variable:'wcp_v_price' -%}{%- endcapture -%}
{%- capture wcp_v_compare_at_price -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wcp_v_discounted_prices, price_variable:'wcp_v_compare_at_price' -%}{%- endcapture -%}

{% assign  wcp_price = wcp_price | minus: 0 %}
{% if wcp_compare_at_price != blank %}
	{% assign  wcp_compare_at_price = wcp_compare_at_price | minus: 0 %}
{% else %}
{% assign  wcp_compare_at_price = nil %}
{% endif %}

{% assign  wcp_compare_at_price_min = wcp_compare_at_price_min | minus: 0 %}
{% assign  wcp_compare_at_price_max = wcp_compare_at_price_max | minus: 0 %}
{% assign  wcp_price_min = wcp_price_min | minus: 0 %}
{% assign  wcp_price_max = wcp_price_max | minus: 0 %}

{% assign  wcp_v_price = wcp_v_price | minus: 0 %}
{% if wcp_v_compare_at_price != blank %}
	{% assign  wcp_v_compare_at_price = wcp_v_compare_at_price | minus: 0 %}
{% else %}
{% assign  wcp_v_compare_at_price = nil %}
{% endif %}

Please replace the product variable with the correct variable if needed.

{% capture wpd_discounted_prices %} {%- render 'wcp_discount' wcp_discount:product , wpd_is_render:'yes' -%}{% endcapture %}

Please replace the variant variable with the correct variable if needed.

{% capture wcp_v_discounted_prices %}{%- render 'wcp_variant' , wcp_variant:product.selected_or_first_available_variant , set_prices_array:set_prices_array , wpd_is_render:'yes', v_discount_tag : v_discount_tag , wcp_discount_value : wcp_discount_value -%}{%- endcapture -%}

Currently, this code does not contain the volume discount code. so you have to pass it from the parents if required. Also, the app code used in the cart page does not have a render version yet.

Last updated