×

Developed a Multi-Step Solution

For E-commerce Success

Client Requirement

Integrating B2B pricing from SAP ERP system into existing Shopify store.

Business Problem

B2B business face challenges with Shopify's B2C-focused platform and its limitations as a SaaS application. Specifically, B2B store owners struggle to integrate their ERP pricing seamlessly into the Shopify checkout process.

Team Integriti devised a multi-step solution using custom development and Shopify’s app development features.  

  • Retail buyers log into Shopify and navigate through the website, where prices are displayed with a disclaimer indicating possible changes at checkout.

  • Customers add items to their cart, and upon checkout, an API is invoked to simulate prices.

  • This API revises item prices, tax rates, and shipping charges as needed, and can also add or remove goods from the cart.

Technical Solution
Shopify Development Details Requested by Our Client Company

The client requested the creation of custom fields for “Sold to Number” and “Ship to Number,” a disclaimer about potential price changes at checkout, and changes to the checkout process to call a custom API with specific inputs and outputs.

Shopify’s Actions During checkout:

Shopify will use this information and do the following:

  • Stores list prices for each SKU in the cart

  • Calls the API to retrieve ERP prices

  • Updates the tax rate based on the API response

  • Modifies the cart according to the API response

  • Overrides the shipping amount as per the API response

  • Sets the prices back to list prices

Example Scenario:

If a customer adds an item listed at $23.00, the checkout process will update the price to $20.00 based on the SAP price, with shipping at $5.00 and a 10% tax rate, while the list price remains unchanged.

Integriti’s Approach and App Architecture  

Our team leveraged the Node boilerplate provided by Shopify to gain in-depth understanding of its structure and database framework.  

Shopify Authentication:  

Maintaining application security through proper authentication was a significant challenge. We addressed this by implementing  Shopify Auth, strictly following Shopify’s developer guidelines for secure authentication. (Link: https://shopify.dev/docs/apps/auth)  

Session Token Management:  

 Managing session tokens for secure API calls to Shopify Admin APIs was another major hurdle.  

 We implemented two token types:  

Offline Session Token: 

Used when the application needs resources without immediate user presence.  

Online Session Token: 

Used when a user is actively using the application.

Solution 1: Webhook Integration

  • Utilized webhooks and data manipulation for B2B pricing at checkout.

  • Triggered by Shopify webhook “CHECKOUT CREATE” to initiate checkout attempts.

  • Data captured included customer and cart information for processing.

  • Products were transformed to meet SAP API requirements.

  • Customer ID used to retrieve shipping and billing details via Shopify APIs

  • Aggregated data into JSON object, converted to XML format for SAP.

  • Error handling redirected users to standard checkout in case of SAP issues.

Outcome

This solution technically achieved B2B pricing at checkout, but the client later opted for a different approach due to:

  • Lack of price consistency for all customers.

  • Lack of dynamic B2B pricing, specific to each customer without affecting store-wide prices.

Proposed and Developed Solutions for Seamless Integration

Solution 2: Draft Order Integration

  • Similar to Solution 1 but utilized draft orders for pricing updates.

  • Webhook triggered on “CHECKOUT CREATE” to initiate checkout.

  • Customer and cart data processed for pricing updates.  

  • Aggregated and converted data to XML format for SAP.

  • Upon SAP response, draft orders created with updated prices.

  • Customers received draft order URL for purchase completion.  

Outcome

While this solution addressed the client’s immediate requirement, they later reconsidered due to Shopify Webhook Delays, especially under high customer traffic.

Solution 3: Frontend Price Change

  • Explored alternative methods due to Shopify webhook delays.

  • Leveraged App proxy and theme-app-extension for pricing updates.

  • Non-registered customers proceed through standard checkout.

  • Registered users’ default address verified for completeness.  

  • Customer data obtained via theme-app-extension for SAP interaction.  

  • Upon SAP response, draft orders created with updated prices.  

  • Draft order checkout URL sent to frontend for purchase completion.

Outcome

This solution addressed the challenges of webhooks and fulfilled the client’s requirements, making it the accepted solution.

Deployment Approach:

Initially deployed on both Heroku and Fly.io for environment understanding. Eventually, opted for exclusive hosting on Heroku for the final deployment.

Challenges We Faced:

Default SQLite database in Shopify Node app boilerplate lacks persistence. Addressed by migrating to PostgreSQL for robust data management.

Deployment Procedure:

  • Explored alternative methods due to Shopify webhook delays.

  • Leveraged App proxy and theme-app-extension for pricing updates.

  • Non-registered customers proceed through standard checkout.

  • Registered users’ default address verified for completeness.  

  • Customer data obtained via theme-app-extension for SAP interaction.  

  • Upon SAP response, draft orders created with updated prices.  

  • Draft order checkout URL sent to frontend for purchase completion.

Have An IDEA WE CAN HELP.

Start YOUR PROJECT

Minneapolis

7760 France Ave South
Suite 1100 Bloomington,
MN 55435

Toronto

2 Robert Speck Parkway
Suite 750 Mississauga,
Ontario L4Z 1H8, Canada

Mexico

Paseo de la Reforma 284
Mexico City, Mexico 06600