Example Theme Integration
Please follow the steps shown in this article to carry out the theme integration process according to the Wholesale Pricing Discount subscription plan.
Before you start integrating a theme, it's a good idea to make a backup copy so that you can discard your changes and start again if you need to. Checkout the steps to create backup here.
Don't forget to save the file on each step and test the changes on the storefront.
Theme Integration for the Basic version
Theme.liquid File
Copy the code snippet given below and paste it just above the </body> tag. Our app add this code through automation if you already opened our app once.
Product.liquid File
As we can see from the below screenshot, there are two different sections available under the product.liquid file.
Step 1: Open the product-template section where you will see the pricing variables. Please include following lines at the very top of your file.
Step 2: Find theme default variables responsible for prices and replace theme with our app variables as shown in the below image.
In this example theme, we have only two variables that requires the replacement there may be more variables in your theme. Check for each variable and replace them with the related app variable. You can find variable list here.
Step 3: Our app requires to redirect the customer on the cart page and checkout from there to validate the cart and calculate final discounts. For this reason, if your product page has the Buy Now button, please hide it with the code given below.
Step 4: Paste the lines given below under the theme default JSON snippet as shown in the screenshot. These lines are useful to fetch discounted prices and use them on the areas controlled by JavaScript.
Step 5: Use a JavaScript code to find the discounted prices from the JSON in the previous step to handle the variant selection feature. Usually, this works through the _onSelectChange function under the theme.js file. You can use below given example code and modify it according to your needs and variable names.
Step 6: Under product.liquid, there is one more section product-recommendations. Please open it and you can observe that this section includes product-card-grid which in turn includes the product-price-listing where there is no more further pricing related includes available. So please add all three lines on the top of the product-price-listing file and replace pricing variables with the app variables.
Collection.liquid File
If you open Search.liquid file, it includes the collection-template section.
Now, please open the collection-template section file, which includes product-card-grid and product-card-list liquid snippet files. This both files include the product-price-listing file where we made change in our previous steps.
Search.liquid File
If you open Search.liquid file, it includes the product-card-list which in turn includes the product-price-listing where we already made changes.
Cart.liquid File
If you open the cart.liquid, it includes the cart-template section as shown in the screenshot below. There may be different section names depending on the theme.
Step 1: Open the cart-template section and find the for loop on the cart line items. Paste below given lines exactly under the for loop.
Step 2: Find theme default variables and replace them with respective app variables.
Step 3: Search for the cart subtotal portion and add following classes and elements to it. Our app replaces the div automatically, however, please do this step if no replacement found.
Step 4: Please note, our app works with Shopify Draft Order API hence the additional payment buttons work after the checkout been made through our app. Please hide the additional payment buttons on the cart page through the JavaScript code. Please replace the additional-checkout-buttons class with the class name in your theme.
Theme Integration for the Professional version
The professional version only includes the code for the net terms. Please put the below given lines under the checkout button code or on your desired place in the appropriate cart-template. Please modify the layout and styling according to your theme to match the UI.
Theme Integration for the Enterprise version
The enterprise version integration renders the volume discount (quantity break) tables and appropriate messages on the product page and the cart page.
Product.liquid
Please open appropriate product-template and put few extra lines of code and variables with all those changes for the basic and professional version.
Step 1: Include below lines under the basic integration.
Step 2: Copy and paste the div on the place where you want to show the volume discount table. Generally, it should be added just above where the product form ends.
Step 4: Add the given script just before the product template schema start.
Step 5: Include necessary javascript lines in the _onSelectChange function of the theme.js file exactly below the code added to display discounted price on the variant variant.
Cart.liquid
Step 1: Open the appropriate cart-template and include volume discount files under the lines included for basic theme integration.
Step 2: Add the variable on the place to display the buy more message under the line item.
Last updated